Home > Documentation > Developing > Tutorials > Getting familiar with the development environment > Configuring application specific logging with Log4j |
(Available in Geronimo 2.1.1 and later)
Geronimo uses log4j for logging and the base log4j configuration is in var/log/server-log4j.properties
. If your application also uses log4j for logging you can configure logging in this file. However, this is not self-contained. Instead, you can configure log4j settings specific to your application in your application plugin.
Note that in any case, unless you use <hidden-classes> or <inverse-classloading> to load your own copy of log4j separate from the geronimo copy, log4j will not automatically read any log4j.properties files you may have included in your classpath.
The configuration file server-log4j.properties
is hard-coded in config.ser
and cannot be updated via config.xml
. However, you can swap the default server-log4j.properties
file by overriding system property org.apache.geronimo.log4jservice.configuration
as followed:
export GERONIMO_OPTS=-Dorg.apache.geronimo.log4jservice.configuration=$GERONIMO_HOME/var/log/server-log4j.xml
This example is taken from the apache directory plugin for geronimo, so the paths etc are adapted for that plugin.
WEB-INF/classes/META-INF
. (If you prefer not to place this file under WEB-INF/classes/
, the path of this file must be added to your classpath). But this will obstruct anyone trying to configure logging as the file will remain packed in your application somewhere hard to find.
Copy the log4j.properties file by hand to the appropriate location such as var/my-app/log4j.properties. There is no need to include this file in your app.
Bookmark this on Delicious Digg this | Privacy Policy - Copyright © 2003-2011, The Apache Software Foundation, Licensed under ASL 2.0. |