logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: strange behavior of my log4j.xml configuration
Date Wed, 13 Aug 2008 14:46:37 GMT
Unless you've taken steps to ensure that each application will log using their 
own instance of log4j or use a Logger Repository Selector that distinguishes, 
somehow, between applications, then all apps will use the same Logger 
Repository (the default one) from a single instance of Log4j.

Most application servers don't use child-first, or parent-last, classloading 
for webapps by default.  Tomcat Standalone is one of the only ones out there 
that does this by default.  Hence, it is usually quite simple to separate 
logging per/application under Tomcat.  Other appservers may have options to 
use child-first classloading.  However, many times you'll run into other 
issues because it's not well supported on other platforms.

I presume each app is manually configuring iteself?  For appservers like 
Weblogic of Websphere, I suggest you put both log4j.jar and log4j.xml in the 
server classpath and get rid of manual configuration code in your apps.

If you want to explore true logging separation and be able to continue to 
manually configure without affecting other apps, then you can look into using 
a repository selector.  However, the concept is confusing for many and may be 
more effort than it is worth.  I'll let you decide...



On Wed, 13 Aug 2008 03:50:09 -0700 (PDT)
  lanes <lanesbalik@yahoo.com> wrote:
> Hi All,
> I got a strange behavior when i deploy my application
> that define the log4j.xml configuration to existing App.Server (say it
> IBM WAS v6.1) then other application's log that already use their own
> log file for example App A log to A.log, App B log to B.log will
> suddenly redirect to SystemOut.log and no longer to their respective
> logs file.
> But when i undeploy my application from the App Server, then other 
>application's log file come back to normal.
> Below is my log4j.xml configuration : 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
>     <!-- Appenders -->
>     <appender name="console"
> class="org.apache.log4j.ConsoleAppender">
>         <param name="DatePattern" value="'.'yyyy-MM-dd"/>
>         <param name="Append" value="true"/>
>         <param name="Threshold" value="debug"/>
>         <param name="Target" value="System.out" />
>         <layout class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern" value="%-5p:%d:%c{1} [%x] -

>%m%n" />
>         </layout>
>     </appender>
>     <appender name="my_file_a_log" 
>         <param name="File"
> value="my_file_a_log.log"/>
>         <param name="DatePattern" value="'.'yyyy-MM-dd"/>
>         <param name="Append" value="true"/>
>         <param name="Threshold" value="debug"/>
>         <layout class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern" value="%-5p:%d:%c{1} [%x] - 
>%m%n" />
>         </layout>
>     </appender>
>     <logger name="mycom.mypackage.ClassMyClass" additivity="false">
>         <level value="info" />
>         <appender-ref ref="my_file_a_log" />
>     </logger>
> <root>
>         <priority value="warn" />
>         <appender-ref ref="console" />
>     </root>
> </log4j:configuration>
> Is it correct?
> Am i missing something?
> My other question is why other application is affected to my log4j.xml 
> I though every application inside the App.Server will have their own 
>respective configuration?
> Please help me.
> your help is really appreciated.
> regards,
> Lanes

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message