Set Logging Level in Spring Boot via Environment Variable

后端 未结 10 1069
刺人心
刺人心 2020-12-23 08:57

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

10条回答
  •  借酒劲吻你
    2020-12-23 09:37

    Starting with Spring Boot 2.0.x this works again. Tested with Spring Boot v2.0.9.RELEASE. E.g. enable connection pool debug log:

    LOGGING_LEVEL_COM_ZAXXER=DEBUG java -jar myApp.jar
    

    or Spring framework debug log:

    LOGGING_LEVEL_ORG_SPRINGFRAMEWORK=DEBUG java -jar myApp.jar
    

    or both:

    LOGGING_LEVEL_ORG_SPRINGFRAMEWORK=DEBUG LOGGING_LEVEL_COM_ZAXXER=DEBUG java -jar myApp.jar
    

    See "Application Poperties" in Spring Boot Reference Documentation for more application properties.

提交回复
热议问题