svn commit: r613 - logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat

Author: seb Date: Fri Sep 29 18:01:08 2006 New Revision: 613 Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java Log: Work in progress: - LogbackValve now implements the Contained interface from tomcat Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java ============================================================================== --- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java (original) +++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java Fri Sep 29 18:01:08 2006 @@ -6,6 +6,8 @@ import javax.servlet.ServletException; +import org.apache.catalina.Contained; +import org.apache.catalina.Container; import org.apache.catalina.Valve; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; @@ -25,8 +27,8 @@ * directly to LogbackValve and LogbackValve uses the same StatusManager as * LoggerContext does. It also provides containers for properties. * <p> - * To configure tomcat in order to use LogbackValve, the following lines must - * be added to the tomcat's server.xml: + * To configure tomcat in order to use LogbackValve, the following lines must be + * added to the tomcat's server.xml: * * <Valve className="ch.qos.logback.access.tomcat.LogbackValve"/> * @@ -40,15 +42,15 @@ * Here is a sample logback.xml file that can be used right away: * * <pre> - * <configuration> - * <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - * <layout class="ch.qos.logback.access.PatternLayout"> - * <param name="Pattern" value="%date %server %remoteIP %clientHost %user %requestURL " /> - * </layout> - * </appender> - * - * <appender-ref ref="STDOUT" /> - * </configuration> + * <configuration> + * <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + * <layout class="ch.qos.logback.access.PatternLayout"> + * <param name="Pattern" value="%date %server %remoteIP %clientHost %user %requestURL " /> + * </layout> + * </appender> + * + * <appender-ref ref="STDOUT" /> + * </configuration> * </pre> * * A special, module-specific implementation of PatternLayout was implemented to @@ -64,7 +66,7 @@ * @author Ceki Gülcü * @author Sébastien Pennec */ -public class LogbackValve extends ContextBase implements Valve, +public class LogbackValve extends ContextBase implements Valve, Contained, AppenderAttachable { public final static String DEFAULT_CONFIG_FILE = "conf" + File.separatorChar @@ -74,6 +76,7 @@ String filename; boolean started; + Container container; Valve nextValve; public LogbackValve() { @@ -106,6 +109,9 @@ public void invoke(Request request, Response response) throws IOException, ServletException { + + nextValve.invoke(request, response); + // System.out.println("**** LogbackValve invoke called"); TomcatServerAdapter adapter = new TomcatServerAdapter(request, response); AccessEvent accessEvent = new AccessEvent(request, response, adapter); @@ -164,4 +170,12 @@ public void setFileName(String fileName) { this.filename = fileName; } + + public Container getContainer() { + return container; + } + + public void setContainer(Container container) { + this.container = container; + } }
participants (1)
-
noreply.seb@qos.ch