From the documentation at https://docs.spring.io/spring-boot/reference/features/logging.html#features.logging.console-output :

you can also specify debug=true in your application.properties.

When the debug mode is enabled, a selection of core loggers (embedded container, Hibernate, and Spring Boot) are configured to output more information.

Answer from abaghel on Stack Overflow
🌐
Baeldung
baeldung.com › home › spring › debugging spring applications
Debugging Spring Applications | Baeldung
February 2, 2026 - There are several ways to start Spring Boot applications. The simplest way is from the command line using the java command with the -jar option. To enable debugging, we simply add the debug argument using the -D option:
Discussions

Spring Boot 3.3.0 Native debug=true in application.properties No effect
I need to debug my Spring Boot v3.3.0 native application built using mvn package -P as it is failing to load application properties from AWS parameter store which was otherwi... More on github.com
🌐 github.com
9
May 28, 2024
java - How can I set the logging level with application.properties? - Stack Overflow
You can enable debug logging by specifying --debug when starting the application from the command-line. Spring Boot provides also a nice starting point for logback to configure some defaults, coloring etc. the base.xml file which you can simply include in your logback.xml file. More on stackoverflow.com
🌐 stackoverflow.com
How do you debug spring application?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
5
2
April 20, 2024
java - Spring Boot requests: to "re-run your application with 'debug' enabled" - how do I? - Stack Overflow
Possible duplicate of How to display auto-configuration report when running a Spring Boot application ... Adding debug=true to the application.properties or debug: true in the application.yml, file should help. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Jamie Tanna
jvt.me › posts › 2022 › 02 › 13 › spring-debug-mode
Determining if the Spring Boot Application is Running in Debug or Trace Mode · Jamie Tanna | Software Engineer
February 13, 2022 - You can do this by running in debug mode, which is most commonly done by setting the debug command-line flag: java -jar /path/to/boot.jar --debug · Or by specifying in our properties file that we're using debug mode: debug=true ·
🌐
Spring
docs.spring.io › spring-boot › docs › 1.5.22.RELEASE › reference › html › boot-features-logging.html
26. Logging - Spring
When the debug mode is enabled, a selection of core loggers (embedded container, Hibernate and Spring Boot) are configured to output more information. Enabling the debug mode does not configure your application to log all messages with DEBUG level. Alternatively, you can enable a “trace” mode by starting your application with a --trace flag (or trace=true in your application.properties).
🌐
GitHub
github.com › spring-projects › spring-boot › issues › 40930
Spring Boot 3.3.0 Native debug=true in application.properties No effect · Issue #40930 · spring-projects/spring-boot
May 28, 2024 - I need to debug my Spring Boot v3.3.0 native application built using mvn package -P <native-profile> as it is failing to load application properties from AWS parameter store which was otherwise working fine till Spring Boot v3.2.5 · So, have added debug=true in application.properties and expected to see additional information on the config failure reported via org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter, but no effect
Published   May 28, 2024
Author   syedyusufh
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_support_for_spring_boot › 2.3 › html › reactive_application_development_guide › debugging-springboot-based-application_spring-boot
Chapter 3. Debugging your Spring Boot-based application | Reactive Application Development Guide | Red Hat support for Spring Boot | 2.3 | Red Hat Documentation
To debug your Spring Boot-based application on OpenShift remotely, you must set the JAVA_DEBUG environment variable inside the container to true and configure port forwarding so that you can connect to your application from a remote debugger.
🌐
Medium
medium.com › @AlexanderObregon › debugging-and-troubleshooting-spring-boot-applications-tips-and-tricks-5206d63a60ba
Debugging and Troubleshooting Spring Boot Applications — Quick Tips and Tricks
April 23, 2024 - Spring Boot’s auto-configuration feature simplifies the setup of your application, but sometimes issues may arise due to misconfiguration. When you run your application with the --debug option or enable debug logging for org.springframework.boot.autoconfigure, Spring Boot generates an auto-configuration report that lists all applied and non-applied configurations, which can help you identify misconfigurations.
Find elsewhere
🌐
JetBrains
jetbrains.com › help › idea › run-debug-configuration-spring-boot.html
Spring Boot run configuration | IntelliJ IDEA Documentation
3 weeks ago - The following options are specific to the Java compiler and runtime for your Spring application: The following options are related to logging the execution of this configuration. For more information, refer to Logs. The following options are related to code coverage. For more information, refer to Code coverage. In this area, you can specify tasks to be performed before starting the selected run/debug configuration.
🌐
Javadeveloperzone
javadeveloperzone.com › spring-boot › spring-boot-enable-debug-logging
Spring boot enable debug logging – Java Developer Zone
We can use one of following option to enable debug logging in spring boot. Pass debug true in application.properties.
Top answer
1 of 16
557

Update: Starting with Spring Boot v1.2.0.RELEASE, the settings in application.properties or application.yml do apply. See the Log Levels section of the reference guide.

logging.level.org.springframework.web: DEBUG
logging.level.org.hibernate: ERROR

For earlier versions of Spring Boot you cannot. You simply have to use the normal configuration for your logging framework (log4j, logback) for that. Add the appropriate config file (log4j.xml or logback.xml) to the src/main/resources directory and configure to your liking.

You can enable debug logging by specifying --debug when starting the application from the command-line.

Spring Boot provides also a nice starting point for logback to configure some defaults, coloring etc. the base.xml file which you can simply include in your logback.xml file. (This is also recommended from the default logback.xml in Spring Boot.

<include resource="org/springframework/boot/logging/logback/base.xml"/>     
2 of 16
142

You can do that using your application.properties.

logging.level.=ERROR -> Sets the root logging level to error
...
logging.level.=DEBUG -> Sets the root logging level to DEBUG

logging.file=${java.io.tmpdir}/myapp.log -> Sets the absolute log file path to TMPDIR/myapp.log

A sane default set of application.properties regarding logging using profiles would be: application.properties:

spring.application.name=<your app name here>
logging.level.=ERROR
logging.file=${java.io.tmpdir}/${spring.application.name}.log

application-dev.properties:

logging.level.=DEBUG
logging.file=

When you develop inside your favourite IDE you just add a -Dspring.profiles.active=dev as VM argument to the run/debug configuration of your app.

This will give you error only logging in production and debug logging during development WITHOUT writing the output to a log file. This will improve the performance during development ( and save SSD drives some hours of operation ;) ).

🌐
HowToDoInJava
howtodoinjava.com › home › spring security › enable debug logging for spring security
Enable Debug Logging for Spring Security
June 9, 2022 - The debug parameter controls debugging support for Spring Security. By default, debug is false. This debug switch helps in logging the complete Authentication request in the logs.
🌐
Medium
medium.com › sprang › debugging-spring-boot-7303b51a8400
Debugging Spring Boot. Spring Boot is a great tool to get a… | by Christoph Huber | sprang | Medium
August 27, 2024 - This can be done by annotating ... priority is given, you can enable this behavior with the property spring.main.allow-bean-definition-overriding=true. Follow the behavior by activating the BeanFactory DEBUG logger:...
🌐
Spring
docs.spring.io › spring-boot › docs › 2.1.13.RELEASE › reference › html › boot-features-logging.html
26. Logging
When the debug mode is enabled, a selection of core loggers (embedded container, Hibernate, and Spring Boot) are configured to output more information. Enabling the debug mode does not configure your application to log all messages with DEBUG level. Alternatively, you can enable a “trace” mode by starting your application with a --trace flag (or trace=true in your application.properties).
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_support_for_spring_boot › 2.1 › html › spring_boot_2.1.x_runtime_guide › debugging-springboot-based-application_spring-boot
Chapter 6. Debugging your Spring Boot-based application | Spring Boot 2.1.x Runtime Guide | Red Hat support for Spring Boot | 2.1 | Red Hat Documentation
To debug your Spring Boot-based application on OpenShift remotely, you must set the JAVA_DEBUG environment variable inside the container to true and configure port forwarding so that you can connect to your application from a remote debugger.
🌐
Spring
docs.spring.io › spring-boot › reference › features › logging.html
Logging :: Spring Boot
When the debug mode is enabled, a selection of core loggers (embedded container, Hibernate, and Spring Boot) are configured to output more information. Enabling the debug mode does not configure your application to log all messages with DEBUG level. Alternatively, you can enable a “trace” mode by starting your application with a --trace flag (or trace=true in your application.properties).
🌐
Dynatrace
rookout.com › __home__ › cloud & monitoring solutions › observability for developers
Spring Boot Debug: How To - Observability for Developers
2 weeks ago - Get to the root cause faster with real-time visibility of your code wherever it's running— from Dev to Production, from bare-metal to Kubernetes​.
🌐
Baeldung
baeldung.com › home › spring › spring boot › display auto-configuration report in spring boot
Display Auto-Configuration Report in Spring Boot | Baeldung
January 8, 2024 - It also shows information about classes that are known to Spring Boot but were not found on the classpath. And, because we’ve set debug=true, then we see it in our output:
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_support_for_spring_boot › 2.4 › html › spring_boot_runtime_guide › debugging-springboot-based-application_spring-boot
Chapter 4. Debugging your Spring Boot-based application | Spring Boot Runtime Guide | Red Hat support for Spring Boot | 2.4 | Red Hat Documentation
To debug your Spring Boot-based application on OpenShift remotely, you must set the JAVA_DEBUG environment variable inside the container to true and configure port forwarding so that you can connect to your application from a remote debugger.
🌐
Reddit
reddit.com › r/javahelp › how do you debug spring application?
r/javahelp on Reddit: How do you debug spring application?
April 20, 2024 -

Sometimes I missed the required annotation or use the annotation wrongly to make it work. Is there any way to troubleshoot it? Besides copying from working example?

Top answer
1 of 5
4
Depending on what you mean by debug, it's not a spring thing, it's an IDE thing. If you mean "I forgot to put the @ Component annotation on something, and now when I try to autowire it is null.... " Well there is your giveaway as to the cause. The challenge here is "i forgot to tell spring that I have this bean"...what exactly is spring going to tell you about something it doesn't know anything about. You should be able to get ahold of the application context and list all of the beans there, that is about the best I've got for you.
2 of 5
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.