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:


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

3. create WEB-INF/classes/ 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 file). A sample log4j.xconf is already provided in WEB-INF.


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:


This is very useful for crazy folk like me who start their production systems via ant ;-)

Note: Make sure the path to the logfile exists. Log4J can create a non-existing file, but not non-existing directories!

CocoonLog4J (last edited 2009-09-20 23:40:24 by localhost)