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
Modifier and Type | Field and Description |
---|---|
static String |
LOG4J_CONFIG
Init parameter specifying the location of the Log4J config file.
|
Constructor and Description |
---|
Log4jConfigurer() |
Modifier and Type | Method and Description |
---|---|
static void |
initLogging()
Initialize Log4J, including setting the web app root system property.
|
static void |
shutdownLogging()
Shuts down Log4J.
|
public static final String LOG4J_CONFIG
Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.