How to find out which Log4j configuration is loaded?

We’re using Log4j (via Slf4j) for logging.

Our log4j configuration is rather simple:

<?xml version="1.0" encoding="UTF-8"?> <Configuration>   <Appenders>     <Console name="Console">       <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>     </Console>   </Appenders>   <Loggers>     <Root level="INFO">       <AppenderRef ref="Console"/>     </Root>     <Logger name="net.sf.jsi.rtree.RTree" level="INFO">       <AppenderRef ref="Console"/>     </Logger>   </Loggers> </Configuration> 

Note that root logger is set to INFO.

However, we’re getting a huge amount of DEBUG logs from a third-party library (net.sf.jsi). Logs we’re absolutely not interested in. My guess is that there’s a different Log4j configuration on the classpath somewhere which gets picked up and sets root logger to DEBUG.

My question is, how could I found which configuration is actually loaded and used by log4j?

Update:

I have seen this "possible duplicate". However, the answer which suggests to use -Dlog4j.debug does not work for me.
I’ve added -Dlog4j.debug to the VM arguments. I only get:

DEBUG StatusLogger org.slf4j.helpers.Log4jLoggerFactory is not on classpath. Good! DEBUG StatusLogger Using ShutdownCallbackRegistry class org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry WARN StatusLogger Multiple logging implementations found:  Factory: org.apache.logging.log4j.core.impl.Log4jContextFactory, Weighting: 10 Factory: org.apache.logging.slf4j.SLF4JLoggerContextFactory, Weighting: 15 Using factory: org.apache.logging.slf4j.SLF4JLoggerContextFactory 

which is not enough info for me.

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.