org.apache.logging.log4j.core.web
Class Log4jContextListener

java.lang.Object
  extended by org.apache.logging.log4j.core.web.Log4jContextListener
All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener

public class Log4jContextListener
extends Object
implements javax.servlet.ServletContextListener

Saves the LoggerContext into the ServletContext as an attribute.


Field Summary
static String LOG4J_CONFIG
          The location of the configuration.
static String LOG4J_CONTEXT_ATTRIBUTE
          The name of the attribute to use to store the LoggerContext into the ServletContext.
static String LOG4J_CONTEXT_NAME
          The name of the LoggerContext.
 
Constructor Summary
Log4jContextListener()
           
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent event)
          Shutdown logging for the web application.
 void contextInitialized(javax.servlet.ServletContextEvent event)
          Initialize Logging for the web application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG4J_CONTEXT_ATTRIBUTE

public static final String LOG4J_CONTEXT_ATTRIBUTE
The name of the attribute to use to store the LoggerContext into the ServletContext.

See Also:
Constant Field Values

LOG4J_CONFIG

public static final String LOG4J_CONFIG
The location of the configuration.

See Also:
Constant Field Values

LOG4J_CONTEXT_NAME

public static final String LOG4J_CONTEXT_NAME
The name of the LoggerContext.

See Also:
Constant Field Values
Constructor Detail

Log4jContextListener

public Log4jContextListener()
Method Detail

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent event)
Initialize Logging for the web application.

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener
Parameters:
event - The ServletContextEvent.

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent event)
Shutdown logging for the web application.

Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener
Parameters:
event - The ServletContextEvent.


Copyright © 1999-2012 Apache Software Foundation. All Rights Reserved. Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, and the Apache Logging project logo are trademarks of The Apache Software Foundation.