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
Also using Spring Boot (v1.2.3) in Cloud Foundry, I've found that it is possible to adjust the root logging level using an environment variable as follows:
$ cf set-env LOGGING_LEVEL_ROOT DEBUG
Unfortunately, it does not appear to be possible to dial-down the logging level for specific packages (at least with the version of Java Buildpack and Spring Boot I am using). For example adding the following in addition to the above does not reduce the log level for Spring framework:
$ cf set-env LOGGING_LEVEL_ORG_SPRINGFRAMEWORK INFO
If you are using something like Splunk to gather your logs, you may be able to filter out the noise, however.
Another alternative which looks promising could be based on customisation of the build pack's arguments option (see here):
$ cf set-env '{arguments: "-logging.level.root=DEBUG -logging.level.org.springframework=INFO"}'
Sadly, I couldn't get this to actually work. I certainly agree that being able to reconfigure logging levels at package level without changing the application code would be handy to get working.