So confused on how to use Spring boot logging
I have a spring boot app which I am struggling to get logging working with a rolling appender strategy.
Here's the relevant part of my pom.xml
org.springframework.boot
spring-boot-starter-parent
1.2.0.RELEASE
org.springframework.boot
spring-boot-starter-actuator
org.springframework
spring-jdbc
phoenix
phoenix
4.1.0-client-hadoop2
commons-dbcp
commons-dbcp
20030825.184428
org.apache.directory.studio
org.apache.commons.pool
1.6
When I just run my app with the pom.xml left alone, I get this error:
java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
I read up on doing exclusions, so I figure I need to add the exclusion to the boot starter, like this:
org.springframework.boot
spring-boot-starter-actuator
log4j-over-slf4j
org.slf4j
Then when I run it, I get this other error:
java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from file:/C:/maven/repo/phoenix/phoenix/4.1.0-client-hadoop2/phoenix-4.1.0-client-hadoop2.jar). If you are using Weblogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml Object of class [org.slf4j.impl.Log4jLoggerFactory] must be an instance of class ch.qos.logback.classic.LoggerContext
So it's talking about some conflict I guess with the phoenix driver but I don't understand why. When I load my pom.xml and look at the Dependency Heirarchy and look for that jar, it doesn't list anything under it that I can try to exclude.
So at this point I don't know how to proceed.
Solved
To remove logback do this:
org.springframework.boot
spring-boot-starter-actuator
log4j-over-slf4j
org.slf4j
logback-classic
ch.qos.logback
Comments
Post a Comment