logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rakesh Patel <rpa...@us.nomura.com>
Subject Re: Log4j Appenders/Category Usage
Date Fri, 07 Oct 2005 14:06:38 GMT
> 
> Because you forgot the attribute additivity="false"
> BTW: you should use the new Identifier "logger". "category" is deprecated.
> 
> <logger name="com.company.a.b.c.f" additivity="false">
> 
> and 
> 
> <logger name="com.company.a.b.d.f" additivity="false">
> 
> Heri
> 
> > -----Original Message-----
> > From: news [mailto:news <at> sea.gmane.org]On Behalf Of Rakesh Patel
> > Sent: Thursday, October 06, 2005 7:08 PM
> > To: log4j-user <at> logging.apache.org
> > Subject: Log4j Appenders/Category Usage
> > 
> > 
> > I have the following log4j.xml file. I've included the 
> > salient portions. here 
> > is what i see:
> > 
> > 1. i see the logs from logger com.company.a.b.c.f in 
> > msglog.log via the 
> > message_appender (info level and above).
> > 
> > 2. i see the logs from logger com.company.a.b.d.f in 
> > msglog.log via the 
> > message_appender (info level and above).
> > 
> > question is : why do i see the logs of message_appender (what 
> > is in msglog.log) 
> > in syslog.log which should only be seeing WARN level 
> > messages????? i'd like to 
> > understand why i am seeing this type of behavior and what is 
> > the correct way to 
> > log what i want which is: system_appender should only log 
> > warn message and 
> > above from all logger com.company and down.
> > 
> > thanks
> > 
> > rakesh
> > 
> > ----
> > 
> > <appender name="message_appender" 
> > class="org.apache.log4j.FileAppender">
> >  <param name="File"  value="msglog.log"/>
> >    <layout class="org.apache.log4j.PatternLayout">
> >  <param name="ConversionPattern" value="[%d{yyyyMMdd 
> > HH:mm:ss}] %m%n"/>
> >    </layout>
> > </appender>
> > 
> > <appender name="system_appender" 
> > class="org.apache.log4j.FileAppender">
> >  <param name="File"  value="syslog.log"/>
> >    <layout class="org.apache.log4j.PatternLayout">
> >  <param name="ConversionPattern" value="[%d{yyyyMMdd 
> > HH:mm:ss}] %m%n"/>
> >    </layout>
> > </appender>
> > 
> > <category name="com.company.a.b.c.f">
> >    <priority value="info"/>
> >      <appender-ref ref="message_appender"/>
> > </category>
> > 
> > <category name="com.company.a.b.d.f">
> >    <priority value="info"/>
> >       <appender-ref ref="message_appender"/>
> > </category>
> > 
> > <category name="com.company">
> >    <priority value="warn"/>
> >       <appender-ref ref="system_appender"/>
> > </category>
> > 

That was very very helpful! i have one more question regarding this matter.

I have individual appenders logging to seperate files for certain classes:

<logger name="com.mycompany.a.b.c.e">
<priority value="info/">
<appender-ref ref="file_e">
</logger>

<logger name="com.mycompany.a.b.d.f">
<priority value="info/">
<appender-ref ref="file_f">
</logger>

<logger name="com.mycompany.a.b.c.g">
<priority value="info/">
<appender-ref ref="file_g">
</logger>

<logger name="com.mycompany.a.b.d.h">
<priority value="info/">
<appender-ref ref="file_h">
</logger>

<logger name="com.mycompany">
<priority value="info/">
<appender-ref ref="everything">
<appender-ref ref="everything_except_what_is_in_file_e_f_g_h">
</logger>

i also care about capturing the logs from the top level as shown in 
the "everything" appender. how do i properly set up my configuration so that 
"everything_except_what_is_in_file_e_f_g_h" is properly logged. as it is, 
the "everything" and "everything_except_what_is_in_file_e_f_g_h" have the same 
logs. "everything_except_what_is_in_file_e_f_g_h" should have all the messages 
from the com.mycompany hierarchy down except what was logged in file_e,f,g,h.


thanks

rakesh






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


Mime
View raw message