logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashish Kulkarni" <ashish.kulkarn...@gmail.com>
Subject Re: Question about logging to multiple files
Date Thu, 23 Aug 2007 20:40:35 GMT
Hi
Work perfect, thank you

On 8/23/07, James A. N. Stauffer <stauffer.james@gmail.com> wrote:
>
> You probably don't want to put the A2 appender in the root section.
> Also if you set additivity="false" in the com.test.me.my.Test
> catagory/logger then the message won't go to the A1 appender.
>
> On 8/23/07, Ashish Kulkarni <ashish.kulkarni13@gmail.com> wrote:
> > Hi
> > I am using XML to define my logging properties,
> > I wanted to know if i can define 2 log files, and have logs in them
> > depending on which class is writing log file
> > for example
> >
> > if the package is
> > com.test.me then the logs should be written to mylog.xml file
> >
> > if the class is
> > com.test.me.my.Test then the logs should be written to mytest.log file.
> >
> > Here is my XML file
> >
> > <appender name="A1" class="org.apache.log4j.DailyRollingFileAppender" >
> > <param name="File" value="C:\\mylog.xml" />
> > <param name="DatePattern" value="'.'yyyy-MM-dd" />
> >
> > <layout class="org.apache.log4j.xml.XMLLayout">
> > </layout>
> > </appender>
> >
> > <appender name="A2" class="org.apache.log4j.DailyRollingFileAppender" >
> > <param name="File" value="c:\\ mytest.log" />
> > <param name="DatePattern" value="'.'yyyy-MM-dd" />
> > <layout class="org.apache.log4j.PatternLayout">
> > <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) -
> %m%n" />
> > </layout>
> > </appender>
> >
> > <category name="com.test.me">
> > <priority value="debug" />
> >
> > <appender-ref ref="A1" />
> > </category>
> >
> >
> > <category name="com.test.me.my.Test">
> > <priority value="debug" />
> >
> > <appender-ref ref="A2" />
> > </category>
> >
> >
> > <root>
> >
> > <appender-ref ref="A1" />
> > <appender-ref ref="A2" />
> >
> > </root>
> >
>
>
> --
> James A. N. Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

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