Thursday, 12 September 2019

springboot, user spring properties in logback.xml

in your logback.xml you can :

<springProperty scope="context" name="root-log-Level"
source="logging.level.root" />
<springProperty scope="context" name="app-log-Level"

source="logging.level.application" />

above will bring spring properties into your logback.xml and then you can use them like :

<root level="${root-log-Level}">
<appender-ref ref="consoleAppender" />

</root>


however, you cannot use it in the logback.xml.  you file must be in another name.e.g. logback-sex.xml


you need to add below in your application.properties file:

logging.config=classpath:logback-sex.xml
logging.level.root=info
logging.level.org.springframework=info
logging.level.org.hibernate=error

logging.level.application=debug



https://github.com/spring-projects/spring-boot/issues/6821

No comments:

Post a comment