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

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by ch.qos.logback.ext.spring.web.LogbackConfigServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class LogbackConfigServlet
extends javax.servlet.http.HttpServlet

Bootstrap servlet for custom Logback initialization in a web environment. Delegates to LogbackWebConfigurer (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 LogbackConfigListener or LogbackConfigServlet). Instead, use a global, VM-wide Logback setup (for example, in JBoss) or JDK 1.4's java.util.logging (which is global too).

Note: This servlet should have a lower load-on-startup value in web.xml than ContextLoaderServlet, when using custom Logback initialization.

Note that this class has been deprecated for containers implementing Servlet API 2.4 or higher, in favor of LogbackConfigListener.
According to Servlet 2.4, listeners must be initialized before load-on-startup servlets. Many Servlet 2.3 containers already enforce this behavior (see ContextLoaderServlet javadocs for details). If you use such a container, this servlet can be replaced with LogbackConfigListener. Else or if working with a Servlet 2.2 container, stick with this servlet.

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

Constructor Summary
LogbackConfigServlet()
           
 
Method Summary
 void destroy()
           
 String getServletInfo()
           
 void init()
           
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This should never even be called since no mapping to this servlet should ever be created in web.xml.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogbackConfigServlet

public LogbackConfigServlet()
Method Detail

init

public void init()
Overrides:
init in class javax.servlet.GenericServlet

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

getServletInfo

public String getServletInfo()
Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class javax.servlet.GenericServlet

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws IOException
This should never even be called since no mapping to this servlet should ever be created in web.xml. That's why a correctly invoked Servlet 2.3 listener is much more appropriate for initialization work ;-)

Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
IOException


Copyright © 2014-2015. All Rights Reserved.