Class LoggingServlet

  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.jackrabbit.j2ee.LoggingServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class LoggingServlet
extends javax.servlet.http.HttpServlet

This Class implements a servlet that is used for initializing the log4j facitilies for the containing webapp. since all classes in a webapp share the same Log4J repository, this servlet offers a centralized mechanism to configure the different loggers.

please note, that Log4J holds its logging repository in static class variables, so the configuration spans all classes using the same classloader hierarchy. in a typical j2ee 4 classloaders are provided by the appserver: a shared, a server, a container and an application classloader:

Bootstrap | System | Shared / \ Server Container / \ Webapp1 Webapp2 ... Classes are searched in the classloader hierarchy by asking the parent classloader first. so if you put the log4j.jar in the 'shared' classloader, all webapps will shared the same log4j logger repository. if every webapp should use it's own hierarchy, the log4j.jar must be put in the classpath of the webapp classloader, usually WEB-INF/lib.

Please note further that the exact way how the classloader hierarchy is set-up depends on the appserver you are using.

See Also:
Serialized Form

Field Summary
          The init param for the log4j configuration.
Constructor Summary
Method Summary
 void init()
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final String INIT_PARAM_LOG4J_CONFIG
The init param for the log4j configuration. this can either point to a resource inside the application or a filepath. if the filename ends with ".xml", the DOMConfigurator is used to configure Log4J, otherwise the PropertyConfigurator is used.

See Also:
Constant Field Values
Constructor Detail


public LoggingServlet()
Method Detail


public void init()
          throws javax.servlet.ServletException

init in class javax.servlet.GenericServlet

Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.