Package org.apache.logging.log4j.web
Class Log4jServletContextListener
- java.lang.Object
-
- org.apache.logging.log4j.web.Log4jServletContextListener
-
- All Implemented Interfaces:
jakarta.servlet.ServletContextListener,java.util.EventListener
public class Log4jServletContextListener extends java.lang.Object implements jakarta.servlet.ServletContextListenerIn 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 intDEFAULT_STOP_TIMEOUTprivate static java.util.concurrent.TimeUnitDEFAULT_STOP_TIMEOUT_TIMEUNITprivate Log4jWebLifeCycleinitializerprivate static java.lang.StringKEY_STOP_TIMEOUTprivate static java.lang.StringKEY_STOP_TIMEOUT_TIMEUNITprivate static LoggerLOGGERprivate jakarta.servlet.ServletContextservletContext
-
Constructor Summary
Constructors Constructor Description Log4jServletContextListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextDestroyed(jakarta.servlet.ServletContextEvent event)voidcontextInitialized(jakarta.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 jakarta.servlet.ServletContext servletContext
-
initializer
private Log4jWebLifeCycle initializer
-
-
Method Detail
-
contextInitialized
public void contextInitialized(jakarta.servlet.ServletContextEvent event)
- Specified by:
contextInitializedin interfacejakarta.servlet.ServletContextListener
-
contextDestroyed
public void contextDestroyed(jakarta.servlet.ServletContextEvent event)
- Specified by:
contextDestroyedin interfacejakarta.servlet.ServletContextListener
-
-