views:

396

answers:

4

Every time I look at Tomcat's catalina.out log file, I see double lines for every log entry. Why is this happening? Has this happen before to any Java (Tomcat) users?

A: 

This happens to me when i have 2 copies of log4j.properties on the classpath. Check for multiple logging configurations

Matt
A: 

Is your webapp's log4j.properties set to log to catalina.out? Tomcat already logs events there and if your application also logs there, that would probably explain the doubled entries.

dmondark
A: 

It most likely has something to do with the order the jars are loaded. On an older project I was on, this would happen all the time, the solution was to reorder the jars in the "perfect" order and things would fix themselves.

It might not just be multiple log4j's, but commons-logging, slf4j, etc. Try rearranging them, but without seeing your classpath ordering, it's hard to help any further.

Greg Noe
+1  A: 

Check your log4j to make sure you are not "double appending" to your logger. Your root logger already has an appender associated with it and if you are filtering an additional category make sure you don't specify an appender unless you want it to go to an appender other than the root.

<category name="org.apache.commons">
    <priority value="warn"/> 
    <!-- don't add the same appender as your root appender -->
</category>
Mike Pone