I'm using spring-boot-starter
, and would like to configure log4j2.xml
to log asynchron + different content to different logfiles.
I created the log4j2 file, but Spring
still uses the spring-boot default logging. How can I switch the logging?
I'm using spring-boot-starter
, and would like to configure log4j2.xml
to log asynchron + different content to different logfiles.
I created the log4j2 file, but Spring
still uses the spring-boot default logging. How can I switch the logging?
I've a better way:
Exclude logback logger:
Add log4j2 boot starter:
Source: http://docs.spring.io/spring-boot/docs/1.5.1.RELEASE/reference/htmlsingle/#howto-configure-log4j-for-logging
Enjoy!
Try this:
Exclude spring-boot-starter-logging e.g.
Add dependencies for your logging interface e.g. slf4j
Add other logging implementations pointing to chosen logging interface e.g.
Add your target logging implementation e.g.
And it should work.
This is what worked for me. Having two additional exclusions. Else Application was not picking up log4j and was had conflict
Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]