info.magnolia.logging
Class Log4jConfigurer

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

public class Log4jConfigurer
extends 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$
Author:
Fabrizio Giustina

Field Summary
static String LOG4J_CONFIG
          Init parameter specifying the location of the Log4J config file.
 
Constructor Summary
Log4jConfigurer()
           
 
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 String LOG4J_CONFIG
Init parameter specifying the location of the Log4J config file.

See Also:
Constant Field Values
Constructor Detail

Log4jConfigurer

public Log4jConfigurer()
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–2014 Magnolia International Ltd.. All rights reserved.