Should it be possible to set logging levels through environment variables alone in a Spring Boot application?
I don't want to use application.properties
as I'm running on Cloud Foundry and want to pick up changes without a deploy (but after the app has restarted, or restaged to be more precise).
I've tried setting env vars like LOGGING_LEVEL_ORG_SPRINGFRAMEWORK=TRACE
but that has no effect. Putting logging.level.org.springframework: TRACE
in application.properties
does work though.
In Settings -> Config Vars set logging. level.com. yourpackage to the desired level (INFO, ERROR, DEBUG).
Spring Boot has a LoggingSystem abstraction that attempts to configure logging based on the content of the classpath. If Logback is available, it is the first choice. You can also set the location of a file to which to write the log (in addition to the console) by using "logging. file".
Spring Boot's default configurations provides a support for the use of Java Util Logging, Log4j2, and Logback. Using these, we can configure the console logging as well as file logging. If you are using Spring Boot Starters, Logback will provide a good support for logging.
This is just an idea, but did you try setting
_JAVA_OPTIONS=-Dlogging.level.org.springframework=TRACE
?
Theoretically, this way -Dlogging.level.org.springframework=TRACE
will be passed as default JVM argument and should affect every JVM instance in your environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With