tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiss Izolda <kiss.izo...@gmail.com>
Subject Problem with using log4j Tomcat and web application level
Date Sun, 16 Sep 2012 10:19:42 GMT
Dear Tomcat Users,

I have configured Tomcat to use log4j according to
http://tomcat.apache.org/tomcat-7.0-doc/logging.html I have used the same
log4j.properties.
My web application is using log4j as well. There is no log4j.jar in
WEB-INF/lib.
I have found entries in the web application's root logger's appender's
file, which was in the Tomcat's root logger's appender's file
(${catalina.base}/logs/catalina.) when there was no webapp added. For
example: 2012-09-16 11:19:57,132  INFO
org.apache.catalina.startup.Catalina.start:652 - Server startup in 2028 ms
Debugging of writing this entry the parent of Category
org.apache.catalina.startup.Catalina seemed to be the web application's
root logger.
After googling on it, I have found, that the problem of "one application
can steal others applications root logger" is known.
I am using Windows7, Tomcat 7.0.26, log4j 1.2.9, and tried with Tomcat
7.0.30, log4j 1.2.17 as well and the result was the same.
The web application's log4j.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    <appender name="MYAPPENDER" class="org.apache.log4j.FileAppender">
        <param name="File"
value="${catalina.base}/logs/myappendersfile.log" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %5p %c.%M:%L - %m%n"
/>
        </layout>
    </appender>
    <root>
        <priority value="info" />
        <appender-ref ref="MYAPPENDER" />
    </root>
</log4j:configuration>
How can I prevent Tomcat from using the web application's root logger?

Thanks in advance,

Izolda

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message