public class Log4jConfigurationLoader extends Object
Each WebApplication in you Servlet Container can have its own key. And so you can configure for each webApplication a separated log4j.xml.
See Example Log4jConfigurationLoaderListener
.
Modifier and Type | Field and Description |
---|---|
static String |
LOG4J_CONFIG_SETTINGS4JKEY
Key for log4j configuration.
|
Constructor and Description |
---|
Log4jConfigurationLoader() |
Modifier and Type | Method and Description |
---|---|
protected DefaultPropertiesLoader |
createDefaultPropertiesLoader()
Create the DefaultPropertiesLoader to use.
|
void |
initLog4jConfiguration(javax.servlet.ServletContext servCxt)
If the InitParameter "Settings4jLog4jConfigurationKey" exists in the given
ServletContext , then Log4j
will be configured with it. |
protected void |
initLogging(String configLocation) |
void |
log(String msg)
Writes the specified message to a servlet log file, usually an event log.
|
void |
log(String message,
Throwable throwable)
Writes an explanatory message and a stack trace for a given
Throwable exception to the servlet log
file. |
public static final String LOG4J_CONFIG_SETTINGS4JKEY
public void initLog4jConfiguration(javax.servlet.ServletContext servCxt)
ServletContext
, then Log4j
will be configured with it.servCxt
- The ServletContext where the InitParameters are configured.protected void initLogging(String configLocation)
configLocation
- location.public void log(String message, Throwable throwable)
Throwable
exception to the servlet log
file. The name and type of the servlet log file is specific to the servlet container, usually an event log.message
- a String
that describes the error or exceptionthrowable
- the Throwable
error or exceptionpublic void log(String msg)
msg
- a String
specifying the message to be written to the log fileprotected DefaultPropertiesLoader createDefaultPropertiesLoader()
Copyright © 2008–2014. All rights reserved.