info.magnolia.logging
Class Log4jConfigurer

java.lang.Object
  extended by info.magnolia.logging.Log4jConfigurer

public abstract class Log4jConfigurer
extends java.lang.Object

Log4j initializer. Loads the file specified using the log4j.config init parameter and optionally set a system property containing the magnolia web application root directory with the name specified by the magnolia.root.sysproperty init parameter.

If magnolia.root.sysproperty is empty no system variable will be set; if log4j.config is empty no log4j initialization will be performed.

You can easily specify relative paths for log4j configuration files using the magnolia root system property, for example using ${magnolia.root}logs/magnolia-debug.log

Note: if you drop multiple magnolia wars in a container which doesn't isolate system properties (e.g. tomcat) you could need to change the name of the magnolia.root.sysproperty variable in web.xml and in log4j configuration files.

Some ideas and snippets borrowed from the more complex Spring implementation http://www.springframework.org

Version:
$Id: Log4jConfigurer.java 32667 2010-03-13 00:37:06Z gjoseph $
Author:
Fabrizio Giustina

Field Summary
static java.lang.String LOG4J_CONFIG
          Init parameter specifying the location of the Log4J config file.
 
Method Summary
static void initLogging()
          Initialize Log4J, including setting the web app root system property.
static void shutdownLogging()
          Shuts down Log4J.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG4J_CONFIG

public static final java.lang.String LOG4J_CONFIG
Init parameter specifying the location of the Log4J config file.

See Also:
Constant Field Values
Method Detail

initLogging

public static void initLogging()
Initialize Log4J, including setting the web app root system property.


shutdownLogging

public static void shutdownLogging()
Shuts down Log4J.



Copyright © 2003-2010 Magnolia International Ltd.. All Rights Reserved.