logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Javier Gonzalez <jagon...@gmail.com>
Subject Re: Need properties files example for multiple output files
Date Tue, 09 Aug 2005 14:09:48 GMT
First define your appenders, like this for example:


<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
      <param name="Target" value="System.out"/>
      <param name="Threshold" value="DEBUG"/>
      <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%d{HH:mm:ss.SSS} %-5p
[%C{2}:%M] %m (%F:%L)%n"/>
      </layout>
</appender>

and then attach them to Loggers like this (for example to the root logger):

<root>
      <priority value="INFO"/>
      <appender-ref ref="CONSOLE"/>
</root>

IIRC, to attach an appender named FOO to a regular (non-root) logger
called foo.bar you would to it like this:

<category name="foo.bar">
  <priority value="ERROR"/>
  <appender-ref ref="FOO"/>
</category>

(somebody please correct me if I remember wrong this last bit)




On 8/9/05, Jitendra Kharche <Jitendra.Kharche@geometricsoftware.com> wrote:
> 
> 
> Hi Rick,
> 
> I have a similar requirement. But I am using xml version of log4j config
> file. When I tried to convert this into an xml config file, I stucked at
> one point. In xml file we define Appender and then provide appender-ref
> in logger defination. Whereas in the configuration given by you, first a
> logger is defined with Level and Name and the name is used to define an
> appender. How this is written in xml config file?
> 
> Thanks in advance.
> Jitendra
> 
> -----Original Message-----
> From: Rick_Herrick@ahm.honda.com [mailto:Rick_Herrick@ahm.honda.com]
> Sent: Wednesday, August 03, 2005 10:55 PM
> To: Log4J Users List
> Subject: Re: Need properties files example for multiple output files
> 
> Something like this:
> 
> # Root logger
> log4j.rootLogger=FATAL, console
> 
> # World Company logger definitions
> log4j.logger.com.worldcompany.application=FATAL, main
> log4j.logger.com.worldcompany.application.base=ERROR, base
> log4j.logger.com.worldcompany.application.net=DEBUG, net
> 
> # Console output
> log4j.appender.console.layout=org.apache.log4j.PatternLayout
> log4j.appender.console.layout.ConversionPattern=%d{ISO8601} [%5.5t] %-5p
> %c{2} - %m%n log4j.appender.console=org.apache.log4j.ConsoleAppender
> 
> # Main logger
> log4j.appender.main=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.main.file=${catalina.home}/logs/log_application.fatal
> log4j.appender.main.layout=org.apache.log4j.PatternLayout
> log4j.appender.main.layout.ConversionPattern=%d{ISO8601} [%5.5t] %-5p %c
> - %m%n
> 
> # Base logger
> log4j.appender.base=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.base.file=${catalina.home}/logs/log_application.base.err
> log4j.appender.base.layout=org.apache.log4j.PatternLayout
> log4j.appender.base.layout.ConversionPattern=%d{ISO8601} [%5.5t] %-5p %c
> - %m%n
> 
> # Net logger
> log4j.appender.net=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.net.file=${catalina.home}/logs/log_application.net.debug
> log4j.appender.net.layout=org.apache.log4j.PatternLayout
> log4j.appender.net.layout.ConversionPattern=%d{ISO8601} [%5.5t] %-5p %c
> - %m%n
> 
> 
> 
> 
> 
>              Xavier Outhier
> 
>              <xavier.outhier@s
> 
>              iemens.com>
> To
>                                        log4j-user@logging.apache.org
> 
>              08/03/2005 10:03
> cc
>              AM
> 
> 
> Subject
>                                        Need properties files example for
> 
>              Please respond to         multiple output files
> 
>                "Log4J Users
> 
>                    List"
> 
>              <log4j-user@loggi
> 
>               ng.apache.org>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Hi,
> 
> sorry to ask this newbie question.
> Could someone sent me or redirect me to a sample of a properties file
> that will create several output files trace with of course different
> content.
> 
> For instance I want to trace
> 
> ERROR of com.worldcompany.application.base to log_application.base.err
> DEBUG of com.worldcompany.application.net to log_application.net.debug
> FATAL of com.worldcompany.application to log_application.fatal
> 
> thanx,
> 
> Xavier.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 


-- 
Javier Gonzalez Nicolini

---------------------------------------------------------------------
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