Search code examples
spring-bootlogginglog4jslf4j

Can I enable DEBUG log level of a spring boot application with a VM property?


I'd like to enable DEBUG log level of my spring boot application. Like mentioned in this answer https://stackoverflow.com/a/74678907/8315843, it's possible by modifying application.properties and rebuilding, repackaging and redeploying. Is it possible to do the same by just changing a command line option such as a VM property and restarting ?

I use slf4j logging with code such as this :

    private final Logger logger = LoggerFactory.getLogger(getClass());

Please note, I'm not talking about the spring boot framework log level that can be set with a --debug, but the log level of the application that uses its org.slf4j.Logger and its own calls to logger.debug.


Solution

  • Not a VM property, but a command-line option :

    --logging.level.root=debug