logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Problem while logging different levels in different log files
Date Fri, 08 Dec 2006 16:38:56 GMT

Search the list for recent discussions about using filters.  BTW, you'll need to
change to an XML config format to use filters.

Not specifically applicable to this situation, at times you can use additivity
if you want to control which loggers/levels log to particular appenders at the
logger level.  Basically, setting additivity to "false" disables the normal
logger hierarchy inheritance.  Again, doesn't apply here, but I thought I'd
mention it.

Jake

Quoting "Zadoo, Vishal (Accenture)" <Vishal.Zadoo@ottogroup.com>:

>
>
>
>
> Hi,
> I need to log different levels of log in different log files
> exclusively. I am using the following log4j.properties:
> # Set root logger level to DEBUG and its only appender to A1.
>
> log4j.rootLogger=INFO,A1,A2
>
>
>
> # A1 is set to trace.log.
>
> log4j.appender.A1=org.apache.log4j.RollingFileAppender
>
> log4j.appender.A1.File=trace.log
>
> log4j.appender.A1.Threshold=INFO
>
> # A1 uses PatternLayout.
>
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>
> log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
>
>
>
> # A2 is set to be a fileAppender named error.log
>
> log4j.appender.A2=org.apache.log4j.RollingFileAppender
>
> log4j.appender.A2.File=error.log
>
> log4j.appender.A2.Threshold=ERROR
>
> # A2 uses PatternLayout.
>
> log4j.appender.A2.layout=org.apache.log4j.PatternLayout
>
> log4j.appender.A2.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
>
> Currently im facing the problem that my error level messages are going
> to a error.log , but my trace level message file(trace.log) has both
> trace and error messages. It shud contain only trace level messages.
> Has anybody tried something like this before?
>
>
> Vishal
>
>




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


Mime
View raw message