ch.qos.logback.ext.spring.web
Class LogbackConfigListener

java.lang.Object
  extended by ch.qos.logback.ext.spring.web.LogbackConfigListener
All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener

public class LogbackConfigListener
extends Object
implements javax.servlet.ServletContextListener

Bootstrap listener for custom Logback initialization in a web environment. Delegates to WebLogbackConfigurer (see its javadoc for configuration details).

WARNING: Assumes an expanded WAR file, both for loading the configuration file and for writing the log files. If you want to keep your WAR unexpanded or don't need application-specific log files within the WAR directory, don't use Logback setup within the application (thus, don't use Log4jConfigListener or LogbackConfigServlet). Instead, use a global, VM-wide Log4J setup (for example, in JBoss) or JDK 1.4's java.util.logging (which is global too).

This listener should be registered before ContextLoaderListener in web.xml, when using custom Logback initialization.

For Servlet 2.2 containers and Servlet 2.3 ones that do not initialize listeners before servlets, use LogbackConfigServlet. See the ContextLoaderServlet javadoc for details.

Since:
0.1
Author:
Juergen Hoeller, Les Hazlewood
See Also:
WebLogbackConfigurer, LogbackConfigListener, LogbackConfigServlet

Constructor Summary
LogbackConfigListener()
           
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent event)
           
 void contextInitialized(javax.servlet.ServletContextEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogbackConfigListener

public LogbackConfigListener()
Method Detail

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent event)
Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent event)
Specified by:
contextInitialized in interface javax.servlet.ServletContextListener


Copyright © 2012-2013. All Rights Reserved.