0
votes

I am receiving the following logs repeatedly while using Spring AMQP:

01:21:54.323 [SimpleAsyncTaskExecutor-1] DEBUG o.s.a.r.l.BlockingQueueConsumer - Retrieving delivery for Consumer: tag=[amq.ctag-XAaHUPISVTmjpL-am3y15g], channel=Cached Rabbit Channel: AMQChannel(....), acknowledgeMode=AUTO local queue size=0 01:21:55.325 [SimpleAsyncTaskExecutor-1] DEBUG o.s.a.r.l.BlockingQueueConsumer - Retrieving delivery for Consumer: tag=[amq.ctag-XAaHUPISVTmjpL-am3y15g], channel=Cached Rabbit Channel: AMQChannel(....), acknowledgeMode=AUTO local queue size=0 01:21:56.327

My log.xml file looks like this

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
    <param name="Target" value="System.out" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%-5p: %c - %m%n" />
    </layout>
</appender>
....
<logger name="org.springframework.amqp.rabbit">
    <level value="off" />
</logger>

<logger name="org.springframework.amqp">
    <level value="off" />
</logger>
<!-- Root Logger -->
<root>
    <priority value="off" />
    <appender-ref ref="console" />
</root>

</log4j:configuration>

Upon closer inspection I found that the BlockingQueueConsumer class in org.springframework.amqp.rabbit emits the above logs and the exact line is

if (logger.isDebugEnabled()) {
            logger.debug("Retrieving delivery for " + this);
        } 

My question is how is this possible given the above log4j.xml entries. Am I missing something. I am using the following loggers slf4j-api-1.6.6.jar,slf4j-log4j12-1.6.6.jar,log4j-1.2.15.jar

EDIT

With reference to the comments by zapl I started this project with STS and used a new Spring MVC Project the log files weren't manually configured. Is the project reading the log file from some other xml?

1
Are you sure this config file is actually in use, e.g. when you change the pattern is that change picked up? (shouldn't it print DEBUG: with : ?)zapl

1 Answers

0
votes

Thanks for pointing that out zapl. I found the issue. In the web.xml file you should mention this

<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>/WEB-INF/resource/log4j.properties</param-value>
</context-param>

 <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

Refer to this answer: How to configure the log4j output file path in web.xml and log4j.properties?