Package org.apache.logging.log4j.web
Class Log4jServletContextListener
- java.lang.Object
-
- org.apache.logging.log4j.web.Log4jServletContextListener
-
- All Implemented Interfaces:
java.util.EventListener
,javax.servlet.ServletContextListener
public class Log4jServletContextListener extends java.lang.Object implements javax.servlet.ServletContextListener
In environments older than Servlet 3.0, this initializer is responsible for starting up Log4j logging before anything else happens in application initialization. In all environments, this shuts down Log4j after the application shuts down.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
DEFAULT_STOP_TIMEOUT
private static java.util.concurrent.TimeUnit
DEFAULT_STOP_TIMEOUT_TIMEUNIT
private Log4jWebLifeCycle
initializer
private static java.lang.String
KEY_STOP_TIMEOUT
private static java.lang.String
KEY_STOP_TIMEOUT_TIMEUNIT
private static Logger
LOGGER
private javax.servlet.ServletContext
servletContext
-
Constructor Summary
Constructors Constructor Description Log4jServletContextListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextDestroyed(javax.servlet.ServletContextEvent event)
void
contextInitialized(javax.servlet.ServletContextEvent event)
-
-
-
Field Detail
-
DEFAULT_STOP_TIMEOUT
private static final int DEFAULT_STOP_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_STOP_TIMEOUT_TIMEUNIT
private static final java.util.concurrent.TimeUnit DEFAULT_STOP_TIMEOUT_TIMEUNIT
-
KEY_STOP_TIMEOUT
private static final java.lang.String KEY_STOP_TIMEOUT
- See Also:
- Constant Field Values
-
KEY_STOP_TIMEOUT_TIMEUNIT
private static final java.lang.String KEY_STOP_TIMEOUT_TIMEUNIT
- See Also:
- Constant Field Values
-
LOGGER
private static final Logger LOGGER
-
servletContext
private javax.servlet.ServletContext servletContext
-
initializer
private Log4jWebLifeCycle initializer
-
-
Method Detail
-
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent event)
- Specified by:
contextInitialized
in interfacejavax.servlet.ServletContextListener
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent event)
- Specified by:
contextDestroyed
in interfacejavax.servlet.ServletContextListener
-
-