Date: 2004-10-13T05:58:59
   Editor: HelmaVanDerLinden <[EMAIL PROTECTED]>
   Wiki: Cocoon Wiki
   Page: CocoonLog4J
   URL: http://wiki.apache.org/cocoon/CocoonLog4J

   no comment

New Page:

How to use Log4J instead of Avalon Logkit for Cocoon.

This is written based on the 2.1.6-DEV version in SVN at 2004/10/13, so things 
might be different before or after this version.

1. '''add this to web.xml''' or, if it is already in comments, uncomment it:

{{{
  <init-param>
        <param-name>logger-class</param-name>
        
<param-value>org.apache.avalon.excalibur.logger.Log4J!LoggerManager</param-value>
  </init-param>
}}}    

2. '''add log4j.jar''' in WEB-INF/lib if needed

3. '''create WEB-INF/classes/log4j.properties''' to setup logging, or uncomment 
the following lines in web.xml to define the location of log4j.xconf (i.e. the 
XML version of the log4j.properties file). A sample log4j.xconf is already 
provided in WEB-INF.

{{{
      <init-param>
        <param-name>log4j-config</param-name>
        <param-value>/WEB-INF/log4j.xconf</param-value>
      </init-param>
}}}

4. (added by BertrandDelacretaz:) Another useful logging trick is to '''use 
log4j for the output of ant''' as 
well, by setting these options on the ant command line:
{{{
   -listener org.apache.tools.ant.listener.Log4jListener
   -Dlog4j.configuration=file:/path-to-log4j-config
}}}
''This is very useful for crazy folk like me who start their production 
systems via ant ;-)''