diff --git a/.gitignore b/.gitignore
index 9539fb57edf2cf5094171fa9e2fcba92f1ca260b..6b74944ed9877e6e00248f5b7f1e209cb05633b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
-.settings
-target
-.classpath
-.project
+.settings
+target
+.classpath
+.project
*~
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
index 046cbb31c570690d7cc4b9ff47a8a2c8d2eeb1ba..68acacea8803eb56f6a8b74777c2ad44d1fecab9 100755
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,15 +1,15 @@
-Logback LICENSE
----------------
-
-Logback: the reliable, generic, fast and flexible logging framework.
-Copyright (C) 1999-2009, QOS.ch. All rights reserved.
-
-This program and the accompanying materials are dual-licensed under
-either the terms of the Eclipse Public License v1.0 as published by
-the Eclipse Foundation
-
- or (per the licensee's choosing)
-
-under the terms of the GNU Lesser General Public License version 2.1
-as published by the Free Software Foundation.
-
+Logback LICENSE
+---------------
+
+Logback: the reliable, generic, fast and flexible logging framework.
+Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+
+This program and the accompanying materials are dual-licensed under
+either the terms of the Eclipse Public License v1.0 as published by
+the Eclipse Foundation
+
+ or (per the licensee's choosing)
+
+under the terms of the GNU Lesser General Public License version 2.1
+as published by the Free Software Foundation.
+
diff --git a/README.txt b/README.txt
index 362dcb66b986f4d645812446d30121cdef6e61bd..27c3a3e626ef700b64256de0c9c49b33cb41caef 100644
--- a/README.txt
+++ b/README.txt
@@ -1,22 +1,22 @@
-
-Thank you for downloading logback, the reliable, generic, fast and
-flexible logging library for Java.
-
-The Logback documentation can be found under the docs/ directory.
-
-Building logback
-================
-
-Building logback is documented at:
-
- http://logback.qos.ch/manual/introduction.html#BuildingLogback
-
-In case of problems
-===================
-
-In case of problems please do not hesitate to post an e-mail message
-on the logback-user@qos.ch mailing list. However, please do not
-directly e-mail logback developers. The answer to your question might
-be useful to other users. Moreover, there are many knowledgeable users
-on the logback-user mailing lists who can quickly answer your
+
+Thank you for downloading logback, the reliable, generic, fast and
+flexible logging library for Java.
+
+The Logback documentation can be found under the docs/ directory.
+
+Building logback
+================
+
+Building logback is documented at:
+
+ http://logback.qos.ch/manual/introduction.html#BuildingLogback
+
+In case of problems
+===================
+
+In case of problems please do not hesitate to post an e-mail message
+on the logback-user@qos.ch mailing list. However, please do not
+directly e-mail logback developers. The answer to your question might
+be useful to other users. Moreover, there are many knowledgeable users
+on the logback-user mailing lists who can quickly answer your
questions.
\ No newline at end of file
diff --git a/codeStyle.xml b/codeStyle.xml
index 12c335aa0c1c3c16c62ad14ede2f9c99329eb974..494ae9935a26c6e767d0b7f9b6b62970bad8ed41 100644
--- a/codeStyle.xml
+++ b/codeStyle.xml
@@ -1,264 +1,264 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/logback-access/LICENSE.txt b/logback-access/LICENSE.txt
index 667c2b5dec1895f20ac8ed369045589dc26ff610..d5dac89e45b96875fa0e06a0cf7022e757c4fc52 100644
--- a/logback-access/LICENSE.txt
+++ b/logback-access/LICENSE.txt
@@ -1,22 +1,22 @@
-Logback LICENSE
----------------
-
-Logback: the reliable, generic, fast and flexible logging library for
-Java.
-
-Copyright (C) 2000-2008, QOS.ch
-
-Source code and binaries for logback, including logback-core,
-logback-classic and logback-access modules, are distributed under the
-GNU Lesser General Public License Version 2.1, as published by the
-Free Software Foundation.
-
-This library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of the
-License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
+Logback LICENSE
+---------------
+
+Logback: the reliable, generic, fast and flexible logging library for
+Java.
+
+Copyright (C) 2000-2008, QOS.ch
+
+Source code and binaries for logback, including logback-core,
+logback-classic and logback-access modules, are distributed under the
+GNU Lesser General Public License Version 2.1, as published by the
+Free Software Foundation.
+
+This library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of the
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
diff --git a/logback-access/build.xml b/logback-access/build.xml
index 522bafb280db907139744674687ab8812994ad64..e7728ead925a71ab540b5aa7884defde670a37b0 100644
--- a/logback-access/build.xml
+++ b/logback-access/build.xml
@@ -1,90 +1,90 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- These are the targets supported by this ANT build scpript:
-
- build - compile all project files, if a certain library is missing,
- then the compilation of its dependents are skipped.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ These are the targets supported by this ANT build scpript:
+
+ build - compile all project files, if a certain library is missing,
+ then the compilation of its dependents are skipped.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/logback-access/keywords.html b/logback-access/keywords.html
index ed9e5875eb0889ff1eaaca18eeb042e2fea12c76..91d456c9fc296c2ffdd04bc34707f6c59b93d7b5 100644
--- a/logback-access/keywords.html
+++ b/logback-access/keywords.html
@@ -1,222 +1,222 @@
-
-
-
-
-
-
-
-
-Tomcat
-======
-%a - Remote IP address
-%A - Local IP address
-%b - Bytes sent, excluding HTTP headers, or '-' if zero
-%B - Bytes sent, excluding HTTP headers
-%h - Remote host name (or IP address if resolveHosts is false)
-%H - Request protocol
-%l - Remote logical username from identd (always returns '-')
-%m - Request method (GET, POST, etc.)
-%p - Local port on which this request was received
-%q - Query string (prepended with a '?' if it exists)
-%r - First line of the request (method and request URI)
-%s - HTTP status code of the response
-%S - User session ID
-%t - Date and time, in Common Log Format
-%u - Remote user that was authenticated (if any), else '-'
-%U - Requested URL path
-%v - Local server name
-%D - Time taken to process the request, in millis
-%T - Time taken to process the request, in seconds
-
-Resin
-=====
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+Tomcat
+======
+%a - Remote IP address
+%A - Local IP address
+%b - Bytes sent, excluding HTTP headers, or '-' if zero
+%B - Bytes sent, excluding HTTP headers
+%h - Remote host name (or IP address if resolveHosts is false)
+%H - Request protocol
+%l - Remote logical username from identd (always returns '-')
+%m - Request method (GET, POST, etc.)
+%p - Local port on which this request was received
+%q - Query string (prepended with a '?' if it exists)
+%r - First line of the request (method and request URI)
+%s - HTTP status code of the response
+%S - User session ID
+%t - Date and time, in Common Log Format
+%u - Remote user that was authenticated (if any), else '-'
+%U - Requested URL path
+%v - Local server name
+%D - Time taken to process the request, in millis
+%T - Time taken to process the request, in seconds
+
+Resin
+=====
+
+
+
\ No newline at end of file
diff --git a/logback-access/pom.xml b/logback-access/pom.xml
index 41cf25db73f555e3893379828e4f9132ba96f9c6..8b9482d22be51f6abd758a548ec5a18036f79b06 100644
--- a/logback-access/pom.xml
+++ b/logback-access/pom.xml
@@ -1,205 +1,205 @@
-
-
-
- ch.qos.logback
- logback-parent
- 0.9.18-SNAPSHOT
-
-
- 4.0.0
-
- ch.qos.logback
- logback-access
- ${parent.version}
- jar
- Logback Access Module
-
- http://logback.qos.ch
-
-
- Logback: the reliable, generic, fast and flexible logging library for Java.
-
-
-
-
- Eclipse Public License - v 1.0
- http://www.eclipse.org/legal/epl-v10.html
-
-
-
- GNU Lesser General Public License
- http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
-
-
-
-
-
- ch.qos.logback
- logback-core
- compile
-
-
-
- ch.qos.logback
- logback-core
- test-jar
- test
-
-
-
- tomcat
- catalina
- compile
- true
-
-
-
- org.mortbay.jetty
- jetty
- compile
- true
-
-
-
- org.mortbay.jetty
- servlet-api-2.5
- compile
- true
-
-
-
- janino
- janino
- compile
- true
-
-
-
- hsqldb
- hsqldb
- test
-
-
-
- javax.mail
- mail
- compile
- true
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- once
- plain
- true
-
- **/AllAccessTest.java
- **/PackageTest.java
- **/SerializationPerfTest.java
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
- ${project.build.outputDirectory}/META-INF/MANIFEST.MF
-
-
-
-
- bundle-test-jar
- package
-
- jar
- test-jar
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- bundle-manifest
- process-classes
-
- manifest
-
-
-
-
-
- ch.qos.logback.access.*
- J2SE-1.5
-
-
-
-
-
-
-
-
-
-
-
- host-orion
-
-
-
- mysql
- mysql-connector-java
- 5.0.8
- test
-
-
-
- postgresql
- postgresql
- 8.2-507.jdbc3
-
-
-
-
- com.microsoft.sqlserver
- sqljdbc4
- 2.0
- test
-
-
-
- com.oracle
- ojdbc14
- 10.2.0.1
- test
-
-
-
-
-
-
-
-
+
+
+
+ ch.qos.logback
+ logback-parent
+ 0.9.18-SNAPSHOT
+
+
+ 4.0.0
+
+ ch.qos.logback
+ logback-access
+ ${parent.version}
+ jar
+ Logback Access Module
+
+ http://logback.qos.ch
+
+
+ Logback: the reliable, generic, fast and flexible logging library for Java.
+
+
+
+
+ Eclipse Public License - v 1.0
+ http://www.eclipse.org/legal/epl-v10.html
+
+
+
+ GNU Lesser General Public License
+ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
+
+
+
+
+
+ ch.qos.logback
+ logback-core
+ compile
+
+
+
+ ch.qos.logback
+ logback-core
+ test-jar
+ test
+
+
+
+ tomcat
+ catalina
+ compile
+ true
+
+
+
+ org.mortbay.jetty
+ jetty
+ compile
+ true
+
+
+
+ org.mortbay.jetty
+ servlet-api-2.5
+ compile
+ true
+
+
+
+ janino
+ janino
+ compile
+ true
+
+
+
+ hsqldb
+ hsqldb
+ test
+
+
+
+ javax.mail
+ mail
+ compile
+ true
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.5
+ 1.5
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ once
+ plain
+ true
+
+ **/AllAccessTest.java
+ **/PackageTest.java
+ **/SerializationPerfTest.java
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+
+
+
+ bundle-test-jar
+ package
+
+ jar
+ test-jar
+
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+ bundle-manifest
+ process-classes
+
+ manifest
+
+
+
+
+
+ ch.qos.logback.access.*
+ J2SE-1.5
+
+
+
+
+
+
+
+
+
+
+
+ host-orion
+
+
+
+ mysql
+ mysql-connector-java
+ 5.0.8
+ test
+
+
+
+ postgresql
+ postgresql
+ 8.2-507.jdbc3
+
+
+
+
+ com.microsoft.sqlserver
+ sqljdbc4
+ 2.0
+ test
+
+
+
+ com.oracle
+ ojdbc14
+ 10.2.0.1
+ test
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/AccessConstants.java b/logback-access/src/main/java/ch/qos/logback/access/AccessConstants.java
index b79f48928ca6c90155446083a9ce36443eba7976..107b928e60c51e9a513ebfef58642116120a8c23 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/AccessConstants.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/AccessConstants.java
@@ -1,28 +1,28 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access;
-
-public class AccessConstants {
-
- public final static String LOGBACK_STATUS_MANAGER_KEY = "LOGBACK_STATUS_MANAGER";
- public static final String LB_INPUT_BUFFER = "LB_INPUT_BUFFER";
- public static final String LB_OUTPUT_BUFFER = "LB_OUTPUT_BUFFER";
-
- public final static String X_WWW_FORM_URLECODED = "application/x-www-form-urlencoded";
-
- public final static String IMAGE_CONTENT_TYPE = "image/";
- public final static String IMAGE_JPEG = "image/jpeg";
- public final static String IMAGE_GIF = "image/gif";
- public final static String IMAGE_PNG = "image/png";
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access;
+
+public class AccessConstants {
+
+ public final static String LOGBACK_STATUS_MANAGER_KEY = "LOGBACK_STATUS_MANAGER";
+ public static final String LB_INPUT_BUFFER = "LB_INPUT_BUFFER";
+ public static final String LB_OUTPUT_BUFFER = "LB_OUTPUT_BUFFER";
+
+ public final static String X_WWW_FORM_URLECODED = "application/x-www-form-urlencoded";
+
+ public final static String IMAGE_CONTENT_TYPE = "image/";
+ public final static String IMAGE_JPEG = "image/jpeg";
+ public final static String IMAGE_GIF = "image/gif";
+ public final static String IMAGE_PNG = "image/png";
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/PatternLayout.java b/logback-access/src/main/java/ch/qos/logback/access/PatternLayout.java
index e5bbc2e92d322c8c32d0120bd6f5d3ec922f9e0e..40917f364fdad098d66d9234dfbac2ee563c51ed 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/PatternLayout.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/PatternLayout.java
@@ -1,186 +1,186 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import ch.qos.logback.access.pattern.ContentLengthConverter;
-import ch.qos.logback.access.pattern.DateConverter;
-import ch.qos.logback.access.pattern.EnsureLineSeparation;
-import ch.qos.logback.access.pattern.FullRequestConverter;
-import ch.qos.logback.access.pattern.FullResponseConverter;
-import ch.qos.logback.access.pattern.LineSeparatorConverter;
-import ch.qos.logback.access.pattern.LocalIPAddressConverter;
-import ch.qos.logback.access.pattern.LocalPortConverter;
-import ch.qos.logback.access.pattern.NAConverter;
-import ch.qos.logback.access.pattern.RemoteHostConverter;
-import ch.qos.logback.access.pattern.RemoteIPAddressConverter;
-import ch.qos.logback.access.pattern.RemoteUserConverter;
-import ch.qos.logback.access.pattern.RequestAttributeConverter;
-import ch.qos.logback.access.pattern.RequestContentConverter;
-import ch.qos.logback.access.pattern.RequestCookieConverter;
-import ch.qos.logback.access.pattern.RequestHeaderConverter;
-import ch.qos.logback.access.pattern.RequestMethodConverter;
-import ch.qos.logback.access.pattern.RequestParameterConverter;
-import ch.qos.logback.access.pattern.RequestProtocolConverter;
-import ch.qos.logback.access.pattern.RequestURIConverter;
-import ch.qos.logback.access.pattern.RequestURLConverter;
-import ch.qos.logback.access.pattern.ResponseContentConverter;
-import ch.qos.logback.access.pattern.ResponseHeaderConverter;
-import ch.qos.logback.access.pattern.ServerNameConverter;
-import ch.qos.logback.access.pattern.StatusCodeConverter;
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.pattern.PatternLayoutBase;
-
-/**
- *
- * This class is a module-specific implementation of
- * {@link ch.qos.logback.classic.PatternLayout} to allow http-specific patterns
- * to be used. The ch.qos.logback.access.PatternLayout provides a
- * way to format the logging output that is just as easy and flexible as the
- * usual PatternLayout.
- *
- *
- * For more information about this layout, please refer to the online manual at
- * http://logback.qos.ch/manual/layouts.html#AccessPatternLayout
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public class PatternLayout extends PatternLayoutBase {
-
- public static final Map defaultConverterMap = new HashMap();
-
- public static String CLF_PATTERN = "%h %l %u %t \"%r\" %s %b";
- public static String CLF_PATTERN_NAME = "common";
- public static String CLF_PATTERN_NAME_2 = "clf";
- public static String COMBINED_PATTERN = "%h %l %u %t \"%r\" %s %b \"%i{Referer}\" \"%i{User-Agent}\"";
- public static String COMBINED_PATTERN_NAME = "combined";
-
- static {
-
- defaultConverterMap.put("a", RemoteIPAddressConverter.class.getName());
- defaultConverterMap.put("remoteIP", RemoteIPAddressConverter.class
- .getName());
-
- defaultConverterMap.put("A", LocalIPAddressConverter.class.getName());
- defaultConverterMap.put("localIP", LocalIPAddressConverter.class.getName());
-
- defaultConverterMap.put("b", ContentLengthConverter.class.getName());
- defaultConverterMap.put("B", ContentLengthConverter.class.getName());
- defaultConverterMap
- .put("bytesSent", ContentLengthConverter.class.getName());
-
- defaultConverterMap.put("h", RemoteHostConverter.class.getName());
- defaultConverterMap.put("clientHost", RemoteHostConverter.class.getName());
-
- defaultConverterMap.put("H", RequestProtocolConverter.class.getName());
- defaultConverterMap.put("protocol", RequestProtocolConverter.class
- .getName());
-
- defaultConverterMap.put("i", RequestHeaderConverter.class.getName());
- defaultConverterMap.put("header", RequestHeaderConverter.class.getName());
-
- defaultConverterMap.put("l", NAConverter.class.getName());
-
- defaultConverterMap.put("m", RequestMethodConverter.class.getName());
- defaultConverterMap.put("requestMethod", RequestMethodConverter.class
- .getName());
-
- defaultConverterMap.put("r", RequestURLConverter.class.getName());
- defaultConverterMap.put("requestURL", RequestURLConverter.class.getName());
-
- defaultConverterMap.put("s", StatusCodeConverter.class.getName());
- defaultConverterMap.put("statusCode", StatusCodeConverter.class.getName());
-
- defaultConverterMap.put("t", DateConverter.class.getName());
- defaultConverterMap.put("date", DateConverter.class.getName());
-
- defaultConverterMap.put("u", RemoteUserConverter.class.getName());
- defaultConverterMap.put("user", RemoteUserConverter.class.getName());
-
- defaultConverterMap.put("U", RequestURIConverter.class.getName());
- defaultConverterMap.put("requestURI", RequestURIConverter.class.getName());
-
- defaultConverterMap.put("v", ServerNameConverter.class.getName());
- defaultConverterMap.put("server", ServerNameConverter.class.getName());
-
- defaultConverterMap.put("localPort", LocalPortConverter.class.getName());
-
- defaultConverterMap.put("requestAttribute", RequestAttributeConverter.class
- .getName());
- defaultConverterMap.put("reqAttribute", RequestAttributeConverter.class
- .getName());
-
- defaultConverterMap
- .put("reqCookie", RequestCookieConverter.class.getName());
- defaultConverterMap
- .put("requestCookie", RequestCookieConverter.class.getName());
-
-
- defaultConverterMap.put("responseHeader", ResponseHeaderConverter.class
- .getName());
-
-
- defaultConverterMap.put("requestParameter", RequestParameterConverter.class
- .getName());
- defaultConverterMap.put("reqParameter", RequestParameterConverter.class
- .getName());
-
- defaultConverterMap.put("requestContent", RequestContentConverter.class.getName());
-
- defaultConverterMap.put("responseContent", ResponseContentConverter.class.getName());
-
- defaultConverterMap.put("fullRequest", FullRequestConverter.class.getName());
- defaultConverterMap.put("fullResponse", FullResponseConverter.class.getName());
-
-
- defaultConverterMap.put("n", LineSeparatorConverter.class.getName());
- }
-
-
- public PatternLayout() {
- // set a default value for pattern
- setPattern(CLF_PATTERN);
- // by default postCompileProcessor the is an EnsureLineSeparation instance
- this.postCompileProcessor = new EnsureLineSeparation();
- }
-
- /**
- * Returns the default converter map for this instance.
- */
- public Map getDefaultConverterMap() {
- return defaultConverterMap;
- }
-
- public String doLayout(AccessEvent event) {
- if (!isStarted()) {
- return null;
- }
- return writeLoopOnConverters(event);
- }
-
- @Override
- public void start() {
- if (getPattern().equalsIgnoreCase(CLF_PATTERN_NAME)
- || getPattern().equalsIgnoreCase(CLF_PATTERN_NAME_2)) {
- setPattern(CLF_PATTERN);
- } else if (getPattern().equalsIgnoreCase(COMBINED_PATTERN_NAME)) {
- setPattern(COMBINED_PATTERN);
- }
- super.start();
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import ch.qos.logback.access.pattern.ContentLengthConverter;
+import ch.qos.logback.access.pattern.DateConverter;
+import ch.qos.logback.access.pattern.EnsureLineSeparation;
+import ch.qos.logback.access.pattern.FullRequestConverter;
+import ch.qos.logback.access.pattern.FullResponseConverter;
+import ch.qos.logback.access.pattern.LineSeparatorConverter;
+import ch.qos.logback.access.pattern.LocalIPAddressConverter;
+import ch.qos.logback.access.pattern.LocalPortConverter;
+import ch.qos.logback.access.pattern.NAConverter;
+import ch.qos.logback.access.pattern.RemoteHostConverter;
+import ch.qos.logback.access.pattern.RemoteIPAddressConverter;
+import ch.qos.logback.access.pattern.RemoteUserConverter;
+import ch.qos.logback.access.pattern.RequestAttributeConverter;
+import ch.qos.logback.access.pattern.RequestContentConverter;
+import ch.qos.logback.access.pattern.RequestCookieConverter;
+import ch.qos.logback.access.pattern.RequestHeaderConverter;
+import ch.qos.logback.access.pattern.RequestMethodConverter;
+import ch.qos.logback.access.pattern.RequestParameterConverter;
+import ch.qos.logback.access.pattern.RequestProtocolConverter;
+import ch.qos.logback.access.pattern.RequestURIConverter;
+import ch.qos.logback.access.pattern.RequestURLConverter;
+import ch.qos.logback.access.pattern.ResponseContentConverter;
+import ch.qos.logback.access.pattern.ResponseHeaderConverter;
+import ch.qos.logback.access.pattern.ServerNameConverter;
+import ch.qos.logback.access.pattern.StatusCodeConverter;
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.pattern.PatternLayoutBase;
+
+/**
+ *
+ * This class is a module-specific implementation of
+ * {@link ch.qos.logback.classic.PatternLayout} to allow http-specific patterns
+ * to be used. The ch.qos.logback.access.PatternLayout provides a
+ * way to format the logging output that is just as easy and flexible as the
+ * usual PatternLayout.
+ *
+ *
+ * For more information about this layout, please refer to the online manual at
+ * http://logback.qos.ch/manual/layouts.html#AccessPatternLayout
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public class PatternLayout extends PatternLayoutBase {
+
+ public static final Map defaultConverterMap = new HashMap();
+
+ public static String CLF_PATTERN = "%h %l %u %t \"%r\" %s %b";
+ public static String CLF_PATTERN_NAME = "common";
+ public static String CLF_PATTERN_NAME_2 = "clf";
+ public static String COMBINED_PATTERN = "%h %l %u %t \"%r\" %s %b \"%i{Referer}\" \"%i{User-Agent}\"";
+ public static String COMBINED_PATTERN_NAME = "combined";
+
+ static {
+
+ defaultConverterMap.put("a", RemoteIPAddressConverter.class.getName());
+ defaultConverterMap.put("remoteIP", RemoteIPAddressConverter.class
+ .getName());
+
+ defaultConverterMap.put("A", LocalIPAddressConverter.class.getName());
+ defaultConverterMap.put("localIP", LocalIPAddressConverter.class.getName());
+
+ defaultConverterMap.put("b", ContentLengthConverter.class.getName());
+ defaultConverterMap.put("B", ContentLengthConverter.class.getName());
+ defaultConverterMap
+ .put("bytesSent", ContentLengthConverter.class.getName());
+
+ defaultConverterMap.put("h", RemoteHostConverter.class.getName());
+ defaultConverterMap.put("clientHost", RemoteHostConverter.class.getName());
+
+ defaultConverterMap.put("H", RequestProtocolConverter.class.getName());
+ defaultConverterMap.put("protocol", RequestProtocolConverter.class
+ .getName());
+
+ defaultConverterMap.put("i", RequestHeaderConverter.class.getName());
+ defaultConverterMap.put("header", RequestHeaderConverter.class.getName());
+
+ defaultConverterMap.put("l", NAConverter.class.getName());
+
+ defaultConverterMap.put("m", RequestMethodConverter.class.getName());
+ defaultConverterMap.put("requestMethod", RequestMethodConverter.class
+ .getName());
+
+ defaultConverterMap.put("r", RequestURLConverter.class.getName());
+ defaultConverterMap.put("requestURL", RequestURLConverter.class.getName());
+
+ defaultConverterMap.put("s", StatusCodeConverter.class.getName());
+ defaultConverterMap.put("statusCode", StatusCodeConverter.class.getName());
+
+ defaultConverterMap.put("t", DateConverter.class.getName());
+ defaultConverterMap.put("date", DateConverter.class.getName());
+
+ defaultConverterMap.put("u", RemoteUserConverter.class.getName());
+ defaultConverterMap.put("user", RemoteUserConverter.class.getName());
+
+ defaultConverterMap.put("U", RequestURIConverter.class.getName());
+ defaultConverterMap.put("requestURI", RequestURIConverter.class.getName());
+
+ defaultConverterMap.put("v", ServerNameConverter.class.getName());
+ defaultConverterMap.put("server", ServerNameConverter.class.getName());
+
+ defaultConverterMap.put("localPort", LocalPortConverter.class.getName());
+
+ defaultConverterMap.put("requestAttribute", RequestAttributeConverter.class
+ .getName());
+ defaultConverterMap.put("reqAttribute", RequestAttributeConverter.class
+ .getName());
+
+ defaultConverterMap
+ .put("reqCookie", RequestCookieConverter.class.getName());
+ defaultConverterMap
+ .put("requestCookie", RequestCookieConverter.class.getName());
+
+
+ defaultConverterMap.put("responseHeader", ResponseHeaderConverter.class
+ .getName());
+
+
+ defaultConverterMap.put("requestParameter", RequestParameterConverter.class
+ .getName());
+ defaultConverterMap.put("reqParameter", RequestParameterConverter.class
+ .getName());
+
+ defaultConverterMap.put("requestContent", RequestContentConverter.class.getName());
+
+ defaultConverterMap.put("responseContent", ResponseContentConverter.class.getName());
+
+ defaultConverterMap.put("fullRequest", FullRequestConverter.class.getName());
+ defaultConverterMap.put("fullResponse", FullResponseConverter.class.getName());
+
+
+ defaultConverterMap.put("n", LineSeparatorConverter.class.getName());
+ }
+
+
+ public PatternLayout() {
+ // set a default value for pattern
+ setPattern(CLF_PATTERN);
+ // by default postCompileProcessor the is an EnsureLineSeparation instance
+ this.postCompileProcessor = new EnsureLineSeparation();
+ }
+
+ /**
+ * Returns the default converter map for this instance.
+ */
+ public Map getDefaultConverterMap() {
+ return defaultConverterMap;
+ }
+
+ public String doLayout(AccessEvent event) {
+ if (!isStarted()) {
+ return null;
+ }
+ return writeLoopOnConverters(event);
+ }
+
+ @Override
+ public void start() {
+ if (getPattern().equalsIgnoreCase(CLF_PATTERN_NAME)
+ || getPattern().equalsIgnoreCase(CLF_PATTERN_NAME_2)) {
+ setPattern(CLF_PATTERN);
+ } else if (getPattern().equalsIgnoreCase(COMBINED_PATTERN_NAME)) {
+ setPattern(COMBINED_PATTERN);
+ }
+ super.start();
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java b/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java
index d6ea8adfdba7c4515e961cadf1fc893e9d96d8d3..cc724c4f0e04fa11e1741b0082de7d8eb7f126ee 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java
@@ -1,52 +1,52 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import ch.qos.logback.core.status.StatusManager;
-import ch.qos.logback.core.status.ViewStatusMessagesServletBase;
-
-public class ViewStatusMessagesServlet extends ViewStatusMessagesServletBase {
-
- private static final long serialVersionUID = 443878494348593337L;
-
- @Override
- protected StatusManager getStatusManager(HttpServletRequest req,
- HttpServletResponse resp) {
-
- ServletContext sc = getServletContext();
- StatusManager result = (StatusManager) sc
- .getAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY);
- return result;
-
-// if (result != null) {
-// System.out.println("from ServletContext");
-// return result;
-// } else {
-// HttpSession httpSession = req.getSession(true);
-//
-// System.out.println("from httpSession");
-// return (StatusManager) httpSession
-// .getAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY);
-// }
- }
-
- @Override
- protected String getPageTitle(HttpServletRequest req, HttpServletResponse resp) {
- return "
Status messages for logback-access
\r\n";
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import ch.qos.logback.core.status.StatusManager;
+import ch.qos.logback.core.status.ViewStatusMessagesServletBase;
+
+public class ViewStatusMessagesServlet extends ViewStatusMessagesServletBase {
+
+ private static final long serialVersionUID = 443878494348593337L;
+
+ @Override
+ protected StatusManager getStatusManager(HttpServletRequest req,
+ HttpServletResponse resp) {
+
+ ServletContext sc = getServletContext();
+ StatusManager result = (StatusManager) sc
+ .getAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY);
+ return result;
+
+// if (result != null) {
+// System.out.println("from ServletContext");
+// return result;
+// } else {
+// HttpSession httpSession = req.getSession(true);
+//
+// System.out.println("from httpSession");
+// return (StatusManager) httpSession
+// .getAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY);
+// }
+ }
+
+ @Override
+ protected String getPageTitle(HttpServletRequest req, HttpServletResponse resp) {
+ return "
Status messages for logback-access
\r\n";
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/boolex/JaninoEventEvaluator.java b/logback-access/src/main/java/ch/qos/logback/access/boolex/JaninoEventEvaluator.java
index 49b4b1d62a5324198547624caef7f93f859b29f9..0df27655880acd689009d90516463d1177161356 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/boolex/JaninoEventEvaluator.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/boolex/JaninoEventEvaluator.java
@@ -1,80 +1,80 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.boolex;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.CoreConstants;
-import ch.qos.logback.core.boolex.JaninoEventEvaluatorBase;
-import ch.qos.logback.core.boolex.Matcher;
-
-public class JaninoEventEvaluator extends JaninoEventEvaluatorBase {
-
- public final static List DEFAULT_PARAM_NAME_LIST = new ArrayList();
- public final static List DEFAULT_PARAM_TYPE_LIST = new ArrayList();
-
- static {
- DEFAULT_PARAM_NAME_LIST.add("event");
- DEFAULT_PARAM_TYPE_LIST.add(AccessEvent.class);
- }
-
-
- public JaninoEventEvaluator() {
-
- }
-
- protected String getDecoratedExpression() {
- return getExpression();
- }
-
- protected String[] getParameterNames() {
- List fullNameList = new ArrayList();
- fullNameList.addAll(DEFAULT_PARAM_NAME_LIST);
-
- for(int i = 0; i < matcherList.size(); i++) {
- Matcher m = (Matcher) matcherList.get(i);
- fullNameList.add(m.getName());
- }
-
- return (String[]) fullNameList.toArray(CoreConstants.EMPTY_STRING_ARRAY);
- }
-
- protected Class[] getParameterTypes() {
- List fullTypeList = new ArrayList();
- fullTypeList.addAll(DEFAULT_PARAM_TYPE_LIST);
- for(int i = 0; i < matcherList.size(); i++) {
- fullTypeList.add(Matcher.class);
- }
- return (Class[]) fullTypeList.toArray(CoreConstants.EMPTY_CLASS_ARRAY);
- }
-
- protected Object[] getParameterValues(AccessEvent event) {
- AccessEvent accessEvent = (AccessEvent) event;
- final int matcherListSize = matcherList.size();
-
- int i = 0;
- Object[] values = new Object[DEFAULT_PARAM_NAME_LIST.size()+matcherListSize];
-
- values[i++] = accessEvent;
-
- for(int j = 0; j < matcherListSize; j++) {
- values[i++] = (Matcher) matcherList.get(j);
- }
-
- return values;
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.boolex;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.CoreConstants;
+import ch.qos.logback.core.boolex.JaninoEventEvaluatorBase;
+import ch.qos.logback.core.boolex.Matcher;
+
+public class JaninoEventEvaluator extends JaninoEventEvaluatorBase {
+
+ public final static List DEFAULT_PARAM_NAME_LIST = new ArrayList();
+ public final static List DEFAULT_PARAM_TYPE_LIST = new ArrayList();
+
+ static {
+ DEFAULT_PARAM_NAME_LIST.add("event");
+ DEFAULT_PARAM_TYPE_LIST.add(AccessEvent.class);
+ }
+
+
+ public JaninoEventEvaluator() {
+
+ }
+
+ protected String getDecoratedExpression() {
+ return getExpression();
+ }
+
+ protected String[] getParameterNames() {
+ List fullNameList = new ArrayList();
+ fullNameList.addAll(DEFAULT_PARAM_NAME_LIST);
+
+ for(int i = 0; i < matcherList.size(); i++) {
+ Matcher m = (Matcher) matcherList.get(i);
+ fullNameList.add(m.getName());
+ }
+
+ return (String[]) fullNameList.toArray(CoreConstants.EMPTY_STRING_ARRAY);
+ }
+
+ protected Class[] getParameterTypes() {
+ List fullTypeList = new ArrayList();
+ fullTypeList.addAll(DEFAULT_PARAM_TYPE_LIST);
+ for(int i = 0; i < matcherList.size(); i++) {
+ fullTypeList.add(Matcher.class);
+ }
+ return (Class[]) fullTypeList.toArray(CoreConstants.EMPTY_CLASS_ARRAY);
+ }
+
+ protected Object[] getParameterValues(AccessEvent event) {
+ AccessEvent accessEvent = (AccessEvent) event;
+ final int matcherListSize = matcherList.size();
+
+ int i = 0;
+ Object[] values = new Object[DEFAULT_PARAM_NAME_LIST.size()+matcherListSize];
+
+ values[i++] = accessEvent;
+
+ for(int j = 0; j < matcherListSize; j++) {
+ values[i++] = (Matcher) matcherList.get(j);
+ }
+
+ return values;
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/deleteTables.sql b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/deleteTables.sql
index 6f7fad5d57f55b2fc09eb4815c9360b3b4edf861..bd7c256de0a5493cb93ada0cf5a384b6b6dab836 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/dialect/deleteTables.sql
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/dialect/deleteTables.sql
@@ -1,3 +1,3 @@
-
-delete from access_event_property;
-delete from access_event;
+
+delete from access_event_property;
+delete from access_event;
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/package.html b/logback-access/src/main/java/ch/qos/logback/access/db/package.html
index 4136cac84e9efe218145beda6e1e4986a2a3a274..b6fab1396dee473c819be04e4fa8512a99603ec8 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/package.html
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/package.html
@@ -1,23 +1,23 @@
-
-
-
-
-
-
-
-
-
-
The ch.qos.logback.access.db package provides means to append access events
-into various databases.
-
-
-
Most popular database systems, such as PostgreSQL, MySQL, Oracle, DB2 and MsSQL
-are supported.
-
-
-
Just as importantly, the way for obtaining JDBC connections is pluggable. Connections can
-be obtained through the tradinal way of DriverManager, or alternatively as a DataSource.
-A DataSource can be instantiated directly or it can obtained through JNDI.
-
-
+
+
+
+
+
+
+
+
+
+
The ch.qos.logback.access.db package provides means to append access events
+into various databases.
+
+
+
Most popular database systems, such as PostgreSQL, MySQL, Oracle, DB2 and MsSQL
+are supported.
+
+
+
Just as importantly, the way for obtaining JDBC connections is pluggable. Connections can
+be obtained through the tradinal way of DriverManager, or alternatively as a DataSource.
+A DataSource can be instantiated directly or it can obtained through JNDI.
+
+
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/filter/CountingFilter.java b/logback-access/src/main/java/ch/qos/logback/access/filter/CountingFilter.java
index d88194ac60ff4ab0a2d1418adda05ee79014f11e..ebcc46549e92d4050b2de6b68e1f929d78d44aee 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/filter/CountingFilter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/filter/CountingFilter.java
@@ -1,83 +1,83 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
- package ch.qos.logback.access.filter;
-
-import ch.qos.logback.core.filter.Filter;
-import ch.qos.logback.core.spi.FilterReply;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.StandardMBean;
-import java.lang.management.ManagementFactory;
-
-public class CountingFilter extends Filter {
-
- long total = 0;
- final StatisticalViewImpl accessStatsImpl;
-
- String domain = "ch.qos.logback.access";
-
- public CountingFilter() {
- accessStatsImpl = new StatisticalViewImpl(this);
- }
-
- @Override
- public FilterReply decide(Object event) {
- total++;
- accessStatsImpl.update();
- return FilterReply.NEUTRAL;
- }
-
- public long getTotal() {
- return total;
- }
-
-
- @Override
- public void start() {
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- try {
- ObjectName on = new ObjectName(domain+":Name="+getName());
- StandardMBean mbean = new StandardMBean(accessStatsImpl, StatisticalView.class);
- if (mbs.isRegistered(on)) {
- mbs.unregisterMBean(on);
- }
- mbs.registerMBean(mbean, on);
- super.start();
- } catch (Exception e) {
- addError("Failed to create mbean", e);
- }
- }
-
- @Override
- public void stop() {
- super.stop();
- try {
- MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- ObjectName on = new ObjectName("totp:Filter=1");
- mbs.unregisterMBean(on);
- } catch(Exception e) {
- addError("Failed to unregister mbean", e);
- }
- }
-
- public String getDomain() {
- return domain;
- }
-
- public void setDomain(String domain) {
- this.domain = domain;
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+ package ch.qos.logback.access.filter;
+
+import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.spi.FilterReply;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.StandardMBean;
+import java.lang.management.ManagementFactory;
+
+public class CountingFilter extends Filter {
+
+ long total = 0;
+ final StatisticalViewImpl accessStatsImpl;
+
+ String domain = "ch.qos.logback.access";
+
+ public CountingFilter() {
+ accessStatsImpl = new StatisticalViewImpl(this);
+ }
+
+ @Override
+ public FilterReply decide(Object event) {
+ total++;
+ accessStatsImpl.update();
+ return FilterReply.NEUTRAL;
+ }
+
+ public long getTotal() {
+ return total;
+ }
+
+
+ @Override
+ public void start() {
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ try {
+ ObjectName on = new ObjectName(domain+":Name="+getName());
+ StandardMBean mbean = new StandardMBean(accessStatsImpl, StatisticalView.class);
+ if (mbs.isRegistered(on)) {
+ mbs.unregisterMBean(on);
+ }
+ mbs.registerMBean(mbean, on);
+ super.start();
+ } catch (Exception e) {
+ addError("Failed to create mbean", e);
+ }
+ }
+
+ @Override
+ public void stop() {
+ super.stop();
+ try {
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ ObjectName on = new ObjectName("totp:Filter=1");
+ mbs.unregisterMBean(on);
+ } catch(Exception e) {
+ addError("Failed to unregister mbean", e);
+ }
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/filter/PeriodicStats.java b/logback-access/src/main/java/ch/qos/logback/access/filter/PeriodicStats.java
index f5de93d9c0f7682c3d715a1761f2f7ac14e2768a..a83b0029a9043c13660dc2b6e6598e103fd40d61 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/filter/PeriodicStats.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/filter/PeriodicStats.java
@@ -1,65 +1,65 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.filter;
-
-
-abstract public class PeriodicStats {
-
- private long nextPeriodBegins = 0;
- private long lastTotal = 0;
- private long lastCount = 0;
-
- private double average;
- private int n;
-
- PeriodicStats() {
- this(System.currentTimeMillis());
- }
-
- PeriodicStats(long now) {
- nextPeriodBegins = computeStartOfNextPeriod(now);
- }
-
- void update(long now, long total) {
- if (now > nextPeriodBegins) {
- lastCount = total - lastTotal;
- lastTotal = total;
- average = (average * n + lastCount) / (++n);
- nextPeriodBegins = computeStartOfNextPeriod(now);
- }
- }
-
- public double getAverage() {
- return average;
- }
-
- public long getLastCount() {
- return lastCount;
- }
-
- void reset(long now) {
- nextPeriodBegins = computeStartOfNextPeriod(now);
- lastTotal = 0;
- lastCount = 0;
- average = 0.0;
- n = 0;
- }
-
- void reset() {
- reset(System.currentTimeMillis());
- }
-
- abstract long computeStartOfNextPeriod(long now);
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.filter;
+
+
+abstract public class PeriodicStats {
+
+ private long nextPeriodBegins = 0;
+ private long lastTotal = 0;
+ private long lastCount = 0;
+
+ private double average;
+ private int n;
+
+ PeriodicStats() {
+ this(System.currentTimeMillis());
+ }
+
+ PeriodicStats(long now) {
+ nextPeriodBegins = computeStartOfNextPeriod(now);
+ }
+
+ void update(long now, long total) {
+ if (now > nextPeriodBegins) {
+ lastCount = total - lastTotal;
+ lastTotal = total;
+ average = (average * n + lastCount) / (++n);
+ nextPeriodBegins = computeStartOfNextPeriod(now);
+ }
+ }
+
+ public double getAverage() {
+ return average;
+ }
+
+ public long getLastCount() {
+ return lastCount;
+ }
+
+ void reset(long now) {
+ nextPeriodBegins = computeStartOfNextPeriod(now);
+ lastTotal = 0;
+ lastCount = 0;
+ average = 0.0;
+ n = 0;
+ }
+
+ void reset() {
+ reset(System.currentTimeMillis());
+ }
+
+ abstract long computeStartOfNextPeriod(long now);
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalView.java b/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalView.java
index 4f17e148ebf5f78c862d7e532ef71f1db56b4553..06286f503d18328621fdfe10246414b3b4580408 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalView.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalView.java
@@ -1,39 +1,39 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.filter;
-
-public interface StatisticalView {
-
-
- long getTotal();
-
- long getLastMinuteCount();
- double getMinuteAverage();
-
-
- long getLastHoursCount();
- double getHourlyAverage();
-
-
- long getLastDaysCount();
- double getDailyAverage();
-
-
- long getLastWeeksCount();
- double getWeeklyAverage();
-
- long getLastMonthsCount();
- double getMonthlyAverage();
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.filter;
+
+public interface StatisticalView {
+
+
+ long getTotal();
+
+ long getLastMinuteCount();
+ double getMinuteAverage();
+
+
+ long getLastHoursCount();
+ double getHourlyAverage();
+
+
+ long getLastDaysCount();
+ double getDailyAverage();
+
+
+ long getLastWeeksCount();
+ double getWeeklyAverage();
+
+ long getLastMonthsCount();
+ double getMonthlyAverage();
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalViewImpl.java b/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalViewImpl.java
index de9b8ec3b4cb3bf36da2a6f928663b9585fbd6dd..9fd651aaf815f209cd53e21ef64d02cf05f33819 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalViewImpl.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/filter/StatisticalViewImpl.java
@@ -1,116 +1,116 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.filter;
-
-import ch.qos.logback.core.spi.LifeCycle;
-
-public class StatisticalViewImpl implements StatisticalView, LifeCycle {
-
- final CountingFilter countingFilter;
- boolean started;
-
- StatsByMinute statsByMinute = new StatsByMinute();
- StatsByHour statsByHour = new StatsByHour();
- StatsByDay statsByDay = new StatsByDay();
- StatsByWeek statsByWeek = new StatsByWeek();
- StatsByMonth statsByMonth = new StatsByMonth();
-
- StatisticalViewImpl(CountingFilter countingFilter) {
- this.countingFilter = countingFilter;
- }
-
- public double getDailyAverage() {
- return statsByDay.getAverage();
- }
-
- public long getLastDaysCount() {
- return statsByDay.getLastCount();
- }
-
- public double getMonthlyAverage() {
- return statsByMonth.getAverage();
- }
-
- public long getLastMonthsCount() {
- return statsByMonth.getLastCount();
- }
-
- public long getTotal() {
- return countingFilter.getTotal();
- }
-
- public double getWeeklyAverage() {
- return statsByWeek.getAverage();
- }
-
- public long getLastWeeksCount() {
- return statsByWeek.getLastCount();
- }
-
- void update(long now) {
- long total = getTotal();
- statsByMinute.update(now, total);
- statsByHour.update(now, total);
- statsByDay.update(now, total);
- statsByWeek.update(now, total);
- statsByMonth.update(now, total);
-
- }
-
- void update() {
- long now = System.currentTimeMillis();
- update(now);
- }
-
- public void start() {
- System.out.println("StatisticalViewImpl start called");
- started = true;
- long now = System.currentTimeMillis();
- statsByMinute = new StatsByMinute(now);
- statsByHour = new StatsByHour(now);
- statsByDay = new StatsByDay(now);
- statsByWeek = new StatsByWeek(now);
- statsByMonth = new StatsByMonth(now);
- }
-
- public boolean isStarted() {
- return started;
- }
-
- public void stop() {
- started = false;
- statsByMinute.reset();
- statsByHour.reset();
- statsByDay.reset();
- statsByWeek.reset();
- statsByMonth.reset();
- }
-
- public long getLastMinuteCount() {
- return statsByMinute.getLastCount();
- }
-
- public double getMinuteAverage() {
- return statsByMinute.getAverage();
- }
-
- public double getHourlyAverage() {
- return statsByHour.getAverage();
- }
-
- public long getLastHoursCount() {
- return statsByHour.getLastCount();
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.filter;
+
+import ch.qos.logback.core.spi.LifeCycle;
+
+public class StatisticalViewImpl implements StatisticalView, LifeCycle {
+
+ final CountingFilter countingFilter;
+ boolean started;
+
+ StatsByMinute statsByMinute = new StatsByMinute();
+ StatsByHour statsByHour = new StatsByHour();
+ StatsByDay statsByDay = new StatsByDay();
+ StatsByWeek statsByWeek = new StatsByWeek();
+ StatsByMonth statsByMonth = new StatsByMonth();
+
+ StatisticalViewImpl(CountingFilter countingFilter) {
+ this.countingFilter = countingFilter;
+ }
+
+ public double getDailyAverage() {
+ return statsByDay.getAverage();
+ }
+
+ public long getLastDaysCount() {
+ return statsByDay.getLastCount();
+ }
+
+ public double getMonthlyAverage() {
+ return statsByMonth.getAverage();
+ }
+
+ public long getLastMonthsCount() {
+ return statsByMonth.getLastCount();
+ }
+
+ public long getTotal() {
+ return countingFilter.getTotal();
+ }
+
+ public double getWeeklyAverage() {
+ return statsByWeek.getAverage();
+ }
+
+ public long getLastWeeksCount() {
+ return statsByWeek.getLastCount();
+ }
+
+ void update(long now) {
+ long total = getTotal();
+ statsByMinute.update(now, total);
+ statsByHour.update(now, total);
+ statsByDay.update(now, total);
+ statsByWeek.update(now, total);
+ statsByMonth.update(now, total);
+
+ }
+
+ void update() {
+ long now = System.currentTimeMillis();
+ update(now);
+ }
+
+ public void start() {
+ System.out.println("StatisticalViewImpl start called");
+ started = true;
+ long now = System.currentTimeMillis();
+ statsByMinute = new StatsByMinute(now);
+ statsByHour = new StatsByHour(now);
+ statsByDay = new StatsByDay(now);
+ statsByWeek = new StatsByWeek(now);
+ statsByMonth = new StatsByMonth(now);
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public void stop() {
+ started = false;
+ statsByMinute.reset();
+ statsByHour.reset();
+ statsByDay.reset();
+ statsByWeek.reset();
+ statsByMonth.reset();
+ }
+
+ public long getLastMinuteCount() {
+ return statsByMinute.getLastCount();
+ }
+
+ public double getMinuteAverage() {
+ return statsByMinute.getAverage();
+ }
+
+ public double getHourlyAverage() {
+ return statsByHour.getAverage();
+ }
+
+ public long getLastHoursCount() {
+ return statsByHour.getLastCount();
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByDay.java b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByDay.java
index 18ebc069746409ebf5393b9756633c3e77f3746d..2e96fc2d078ac9646ba617a4ed0e349c95a86147 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByDay.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByDay.java
@@ -1,33 +1,33 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.filter;
-
-import ch.qos.logback.core.util.TimeUtil;
-
-public class StatsByDay extends PeriodicStats {
-
- StatsByDay() {
- super();
- }
-
- StatsByDay(long now) {
- super(now);
- }
-
- @Override
- long computeStartOfNextPeriod(long now) {
- return TimeUtil.computeStartOfNextDay(now);
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.filter;
+
+import ch.qos.logback.core.util.TimeUtil;
+
+public class StatsByDay extends PeriodicStats {
+
+ StatsByDay() {
+ super();
+ }
+
+ StatsByDay(long now) {
+ super(now);
+ }
+
+ @Override
+ long computeStartOfNextPeriod(long now) {
+ return TimeUtil.computeStartOfNextDay(now);
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByHour.java b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByHour.java
index 8d2c2780c098843b1ff2b393de8b2a92d2a2ce72..25de87f24365122f22d2f310bc619203f2a20bc1 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByHour.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByHour.java
@@ -1,33 +1,33 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.filter;
-
-import ch.qos.logback.core.util.TimeUtil;
-
-public class StatsByHour extends PeriodicStats {
-
- StatsByHour() {
- super();
- }
-
- StatsByHour(long now) {
- super(now);
- }
-
- @Override
- long computeStartOfNextPeriod(long now) {
- return TimeUtil.computeStartOfNextHour(now);
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.filter;
+
+import ch.qos.logback.core.util.TimeUtil;
+
+public class StatsByHour extends PeriodicStats {
+
+ StatsByHour() {
+ super();
+ }
+
+ StatsByHour(long now) {
+ super(now);
+ }
+
+ @Override
+ long computeStartOfNextPeriod(long now) {
+ return TimeUtil.computeStartOfNextHour(now);
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByMinute.java b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByMinute.java
index 5e2cc156e22028ab4d3bcb928d05da29e0372ff9..c878e4b26c4a87180ba14bf18253d5db82f1db2d 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByMinute.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByMinute.java
@@ -1,33 +1,33 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.filter;
-
-import ch.qos.logback.core.util.TimeUtil;
-
-public class StatsByMinute extends PeriodicStats {
-
- StatsByMinute() {
- super();
- }
-
- StatsByMinute(long now) {
- super(now);
- }
-
- @Override
- long computeStartOfNextPeriod(long now) {
- return TimeUtil.computeStartOfNextMinute(now);
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.filter;
+
+import ch.qos.logback.core.util.TimeUtil;
+
+public class StatsByMinute extends PeriodicStats {
+
+ StatsByMinute() {
+ super();
+ }
+
+ StatsByMinute(long now) {
+ super(now);
+ }
+
+ @Override
+ long computeStartOfNextPeriod(long now) {
+ return TimeUtil.computeStartOfNextMinute(now);
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByMonth.java b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByMonth.java
index a7d95396cc8316a43ca99d5d43b5568acec10241..a2142a39e8736bbb28bf3ea18116d46884902630 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByMonth.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByMonth.java
@@ -1,33 +1,33 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.filter;
-
-import ch.qos.logback.core.util.TimeUtil;
-
-public class StatsByMonth extends PeriodicStats {
-
- StatsByMonth() {
- super();
- }
-
- StatsByMonth(long now) {
- super(now);
- }
-
- @Override
- long computeStartOfNextPeriod(long now) {
- return TimeUtil.computeStartOfNextMonth(now);
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.filter;
+
+import ch.qos.logback.core.util.TimeUtil;
+
+public class StatsByMonth extends PeriodicStats {
+
+ StatsByMonth() {
+ super();
+ }
+
+ StatsByMonth(long now) {
+ super(now);
+ }
+
+ @Override
+ long computeStartOfNextPeriod(long now) {
+ return TimeUtil.computeStartOfNextMonth(now);
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByWeek.java b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByWeek.java
index 6407a3d6c3a2d655258b25396259ee1f51a812b8..14de1aba9478e4920bf3bdf0a8d536417052f72a 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByWeek.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/filter/StatsByWeek.java
@@ -1,32 +1,32 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.filter;
-
-import ch.qos.logback.core.util.TimeUtil;
-
-public class StatsByWeek extends PeriodicStats {
-
- StatsByWeek() {
- super();
- }
-
- StatsByWeek(long now) {
- super(now);
- }
- @Override
- long computeStartOfNextPeriod(long now) {
- return TimeUtil.computeStartOfNextWeek(now);
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.filter;
+
+import ch.qos.logback.core.util.TimeUtil;
+
+public class StatsByWeek extends PeriodicStats {
+
+ StatsByWeek() {
+ super();
+ }
+
+ StatsByWeek(long now) {
+ super(now);
+ }
+ @Override
+ long computeStartOfNextPeriod(long now) {
+ return TimeUtil.computeStartOfNextWeek(now);
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/html/DefaultCssBuilder.java b/logback-access/src/main/java/ch/qos/logback/access/html/DefaultCssBuilder.java
index 0f833b731514b7cea7d8664d28fe7e923145f4fc..00150eb5cc40de22971990bc8142a15d2a7422b2 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/html/DefaultCssBuilder.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/html/DefaultCssBuilder.java
@@ -1,83 +1,83 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.html;
-
-import static ch.qos.logback.core.CoreConstants.LINE_SEPARATOR;
-import ch.qos.logback.core.html.CssBuilder;
-
-/**
- * This class helps the HTMLLayout build the CSS link. It either provides the
- * HTMLLayout with a default css file, or builds the link to an external,
- * user-specified, file.
- *
- * @author Sébastien Pennec
- */
-public class DefaultCssBuilder implements CssBuilder {
-
- public DefaultCssBuilder() {
- }
-
- public void addCss(StringBuilder sbuf) {
- sbuf.append("");
- }
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.html;
+
+import static ch.qos.logback.core.CoreConstants.LINE_SEPARATOR;
+import ch.qos.logback.core.html.CssBuilder;
+
+/**
+ * This class helps the HTMLLayout build the CSS link. It either provides the
+ * HTMLLayout with a default css file, or builds the link to an external,
+ * user-specified, file.
+ *
+ * @author Sébastien Pennec
+ */
+public class DefaultCssBuilder implements CssBuilder {
+
+ public DefaultCssBuilder() {
+ }
+
+ public void addCss(StringBuilder sbuf) {
+ sbuf.append("");
+ }
}
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/html/HTMLLayout.java b/logback-access/src/main/java/ch/qos/logback/access/html/HTMLLayout.java
index f5b6e9ccbb24561f5a3d1ce19bcea2e0660e7500..e876b757cfa34c6d9660e2fb4bf90c5cd897bda9 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/html/HTMLLayout.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/html/HTMLLayout.java
@@ -1,99 +1,99 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.html;
-
-import static ch.qos.logback.core.CoreConstants.LINE_SEPARATOR;
-
-import java.util.Map;
-
-import ch.qos.logback.access.PatternLayout;
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.html.HTMLLayoutBase;
-import ch.qos.logback.core.pattern.Converter;
-
-/**
- *
- * HTMLLayout outputs events in an HTML table.
- *
- * The content of the table columns are specified using a conversion pattern.
- * See {@link ch.qos.logback.access.PatternLayout} for documentation on the
- * available patterns.
- *
- * For more information about this layout, please refer to the online manual at
- * http://logback.qos.ch/manual/layouts.html#AccessHTMLLayout
- *
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public class HTMLLayout extends HTMLLayoutBase {
-
- /**
- * Default pattern string for log output.
- */
- static final String DEFAULT_CONVERSION_PATTERN = "%h%l%u%t%r%s%b";
-
- /**
- * Constructs a PatternLayout using the DEFAULT_LAYOUT_PATTERN.
- *
- */
- public HTMLLayout() {
- pattern = DEFAULT_CONVERSION_PATTERN;
- cssBuilder = new DefaultCssBuilder();
- }
-
- @Override
- protected Map getDefaultConverterMap() {
- return PatternLayout.defaultConverterMap;
- }
-
- public String doLayout(AccessEvent event) {
- StringBuilder buf = new StringBuilder();
- startNewTableIfLimitReached(buf);
-
- boolean odd = true;
- if (((counter++) & 1) == 0) {
- odd = false;
- }
-
- buf.append(LINE_SEPARATOR);
- buf.append("
");
- buf.append(LINE_SEPARATOR);
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.html;
+
+import static ch.qos.logback.core.CoreConstants.LINE_SEPARATOR;
+
+import java.util.Map;
+
+import ch.qos.logback.access.PatternLayout;
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.html.HTMLLayoutBase;
+import ch.qos.logback.core.pattern.Converter;
+
+/**
+ *
+ * HTMLLayout outputs events in an HTML table.
+ *
+ * The content of the table columns are specified using a conversion pattern.
+ * See {@link ch.qos.logback.access.PatternLayout} for documentation on the
+ * available patterns.
+ *
+ * For more information about this layout, please refer to the online manual at
+ * http://logback.qos.ch/manual/layouts.html#AccessHTMLLayout
+ *
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public class HTMLLayout extends HTMLLayoutBase {
+
+ /**
+ * Default pattern string for log output.
+ */
+ static final String DEFAULT_CONVERSION_PATTERN = "%h%l%u%t%r%s%b";
+
+ /**
+ * Constructs a PatternLayout using the DEFAULT_LAYOUT_PATTERN.
+ *
+ */
+ public HTMLLayout() {
+ pattern = DEFAULT_CONVERSION_PATTERN;
+ cssBuilder = new DefaultCssBuilder();
+ }
+
+ @Override
+ protected Map getDefaultConverterMap() {
+ return PatternLayout.defaultConverterMap;
+ }
+
+ public String doLayout(AccessEvent event) {
+ StringBuilder buf = new StringBuilder();
+ startNewTableIfLimitReached(buf);
+
+ boolean odd = true;
+ if (((counter++) & 1) == 0) {
+ odd = false;
+ }
+
+ buf.append(LINE_SEPARATOR);
+ buf.append("
");
+ buf.append(LINE_SEPARATOR);
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/html/UrlCssBuilder.java b/logback-access/src/main/java/ch/qos/logback/access/html/UrlCssBuilder.java
index 262c00114194432a54ff5204510e54d9e5300c55..569ff773969ed35e288f9c53c9b5402aa0e5117c 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/html/UrlCssBuilder.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/html/UrlCssBuilder.java
@@ -1,46 +1,46 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.html;
-
-import ch.qos.logback.core.html.CssBuilder;
-
-
-/**
- * This class helps the HTMLLayout build the CSS link.
- * It either provides the HTMLLayout with a default css file,
- * or builds the link to an external, user-specified, file.
- *
- * @author Sébastien Pennec
- */
-public class UrlCssBuilder implements CssBuilder {
-
- String url = "http://logback.qos.ch/css/access.css";
-
- public UrlCssBuilder() {
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public void addCss(StringBuilder sbuf) {
- sbuf.append("");
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.html;
+
+import ch.qos.logback.core.html.CssBuilder;
+
+
+/**
+ * This class helps the HTMLLayout build the CSS link.
+ * It either provides the HTMLLayout with a default css file,
+ * or builds the link to an external, user-specified, file.
+ *
+ * @author Sébastien Pennec
+ */
+public class UrlCssBuilder implements CssBuilder {
+
+ String url = "http://logback.qos.ch/css/access.css";
+
+ public UrlCssBuilder() {
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public void addCss(StringBuilder sbuf) {
+ sbuf.append("");
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/html/package.html b/logback-access/src/main/java/ch/qos/logback/access/html/package.html
index 39019b9c241c77d08b25fabf46619b6fc12c7255..c988c3f19ec0d4682a4e18a8aa7c169e7dd2bdfe 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/html/package.html
+++ b/logback-access/src/main/java/ch/qos/logback/access/html/package.html
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
Contains classes to format log output in HTML.
-
-
+
+
+
+
+
+
+
+
+
+
Contains classes to format log output in HTML.
+
+
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java b/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java
index dd774990290a637f8c21b0625fb53de028e44ccf..9741f88b3407529dee8e693d4bc63d372c87079f 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java
@@ -1,62 +1,62 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.jetty;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.mortbay.jetty.HttpFields;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.Response;
-
-import ch.qos.logback.access.spi.ServerAdapter;
-
-/**
- * A jetty specific implementation of the {@link ServerAdapter} interface.
- *
- * @author Sébastien Pennec
- * @author Ceki Gulcu
- */
-public class JettyServerAdapter implements ServerAdapter {
-
- Request request;
- Response response;
-
- public JettyServerAdapter(Request jettyRequest, Response jettyResponse) {
- this.request = jettyRequest;
- this.response = jettyResponse;
- }
-
- public long getContentLength() {
- return response.getContentCount();
- }
-
- public int getStatusCode() {
- return response.getStatus();
- }
-
- public Map buildResponseHeaderMap() {
- Map responseHeaderMap = new HashMap();
- HttpFields httpFields = response.getHttpFields();
- Enumeration e = httpFields.getFieldNames();
- while (e.hasMoreElements()) {
- String key = (String) e.nextElement();
- String value = response.getHeader(key);
- responseHeaderMap.put(key, value);
- }
- return responseHeaderMap;
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.jetty;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.mortbay.jetty.HttpFields;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
+
+import ch.qos.logback.access.spi.ServerAdapter;
+
+/**
+ * A jetty specific implementation of the {@link ServerAdapter} interface.
+ *
+ * @author Sébastien Pennec
+ * @author Ceki Gulcu
+ */
+public class JettyServerAdapter implements ServerAdapter {
+
+ Request request;
+ Response response;
+
+ public JettyServerAdapter(Request jettyRequest, Response jettyResponse) {
+ this.request = jettyRequest;
+ this.response = jettyResponse;
+ }
+
+ public long getContentLength() {
+ return response.getContentCount();
+ }
+
+ public int getStatusCode() {
+ return response.getStatus();
+ }
+
+ public Map buildResponseHeaderMap() {
+ Map responseHeaderMap = new HashMap();
+ HttpFields httpFields = response.getHttpFields();
+ Enumeration e = httpFields.getFieldNames();
+ while (e.hasMoreElements()) {
+ String key = (String) e.nextElement();
+ String value = response.getHeader(key);
+ responseHeaderMap.put(key, value);
+ }
+ return responseHeaderMap;
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java b/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java
index 6ec1579d90f928164f5d8c2f82d3472eb7ca85e1..b19405025b0b50ef9143f6a88e22e200d3623940 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogImpl.java
@@ -1,254 +1,254 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.jetty;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.RequestLog;
-import org.mortbay.jetty.Response;
-
-import ch.qos.logback.access.joran.JoranConfigurator;
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.ContextBase;
-import ch.qos.logback.core.CoreConstants;
-import ch.qos.logback.core.filter.Filter;
-import ch.qos.logback.core.joran.spi.JoranException;
-import ch.qos.logback.core.spi.AppenderAttachable;
-import ch.qos.logback.core.spi.AppenderAttachableImpl;
-import ch.qos.logback.core.spi.FilterAttachable;
-import ch.qos.logback.core.spi.FilterAttachableImpl;
-import ch.qos.logback.core.spi.FilterReply;
-import ch.qos.logback.core.status.ErrorStatus;
-import ch.qos.logback.core.status.InfoStatus;
-import ch.qos.logback.core.status.WarnStatus;
-import ch.qos.logback.core.util.OptionHelper;
-
-/**
- * This class is logback's implementation of jetty's RequestLog interface.
- * It can be seen as logback classic's LoggerContext. Appenders can be attached
- * directly to RequestLogImpl and RequestLogImpl uses the same StatusManager as
- * LoggerContext does. It also provides containers for properties.
To
- * configure jetty in order to use RequestLogImpl, the following lines must be
- * added to the jetty configuration file, namely etc/jetty.xml:
- *
- *
- *
- * By default, RequestLogImpl looks for a logback configuration file called
- * logback-access.xml, in the same folder where jetty.xml is located, that is
- * etc/logback-access.xml. The logback-access.xml file is slightly
- * different than the usual logback classic configuration file. Most of it is
- * the same: Appenders and Layouts are declared the exact same way. However,
- * loggers elements are not allowed.
It is possible to put the logback
- * configuration file anywhere, as long as it's path is specified. Here is
- * another example, with a path to the logback-access.xml file.
- *
- *
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public class RequestLogImpl extends ContextBase implements RequestLog,
- AppenderAttachable, FilterAttachable {
-
- public final static String DEFAULT_CONFIG_FILE = "etc" + File.separatorChar
- + "logback-access.xml";
-
- AppenderAttachableImpl aai = new AppenderAttachableImpl();
- FilterAttachableImpl fai = new FilterAttachableImpl();
- String filename;
- boolean started = false;
-
- public RequestLogImpl() {
- putObject(CoreConstants.EVALUATOR_MAP, new HashMap());
- }
-
- public void log(Request jettyRequest, Response jettyResponse) {
- JettyServerAdapter adapter = new JettyServerAdapter(jettyRequest,
- jettyResponse);
- AccessEvent accessEvent = new AccessEvent(jettyRequest, jettyResponse,
- adapter);
- if (getFilterChainDecision(accessEvent) == FilterReply.DENY) {
- return;
- }
- aai.appendLoopOnAppenders(accessEvent);
- }
-
- public void start() {
- if (filename == null) {
- String jettyHomeProperty = OptionHelper.getSystemProperty("jetty.home");
-
- filename = jettyHomeProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
- getStatusManager().add(
- new WarnStatus("filename property not set. Assuming [" + filename
- + "]", this));
-
- }
- try {
- File configFile = new File(filename);
- if (configFile.exists()) {
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(this);
- jc.doConfigure(filename);
-
- } else {
- getStatusManager().add(
- new ErrorStatus("[" + filename + "] does not exist", this));
- }
-
- if (getName() == null) {
- setName("LogbackRequestLog");
- }
- RequestLogRegistry.register(this);
- getStatusManager().add(
- new InfoStatus("RequestLog added to RequestLogRegistry with name: "
- + getName(), this));
-
- started = true;
-
- } catch (JoranException e) {
- // errors have been registered as status messages
- }
- }
-
- public void stop() {
- aai.detachAndStopAllAppenders();
- started = false;
- }
-
- public boolean isRunning() {
- return started;
- }
-
- public void setFileName(String filename) {
- this.filename = filename;
- }
-
- public boolean isStarted() {
- return started;
- }
-
- public boolean isStarting() {
- return false;
- }
-
- public boolean isStopping() {
- return false;
- }
-
- public boolean isStopped() {
- return !started;
- }
-
- public boolean isFailed() {
- return false;
- }
-
- public void addAppender(Appender newAppender) {
- aai.addAppender(newAppender);
- }
-
- public Iterator> iteratorForAppenders() {
- return aai.iteratorForAppenders();
- }
-
- public Appender getAppender(String name) {
- return aai.getAppender(name);
- }
-
- public boolean isAttached(Appender appender) {
- return aai.isAttached(appender);
- }
-
- public void detachAndStopAllAppenders() {
- aai.detachAndStopAllAppenders();
-
- }
-
- public boolean detachAppender(Appender appender) {
- return aai.detachAppender(appender);
- }
-
- public boolean detachAppender(String name) {
- return aai.detachAppender(name);
- }
-
- public void addFilter(Filter newFilter) {
- fai.addFilter(newFilter);
- }
-
- public void clearAllFilters() {
- fai.clearAllFilters();
- }
-
- public List> getCopyOfAttachedFiltersList() {
- return fai.getCopyOfAttachedFiltersList();
- }
-
- public FilterReply getFilterChainDecision(AccessEvent event) {
- return fai.getFilterChainDecision(event);
- }
-
- public Filter getFirstFilter() {
- return fai.getFirstFilter();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.jetty;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.RequestLog;
+import org.mortbay.jetty.Response;
+
+import ch.qos.logback.access.joran.JoranConfigurator;
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.ContextBase;
+import ch.qos.logback.core.CoreConstants;
+import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.joran.spi.JoranException;
+import ch.qos.logback.core.spi.AppenderAttachable;
+import ch.qos.logback.core.spi.AppenderAttachableImpl;
+import ch.qos.logback.core.spi.FilterAttachable;
+import ch.qos.logback.core.spi.FilterAttachableImpl;
+import ch.qos.logback.core.spi.FilterReply;
+import ch.qos.logback.core.status.ErrorStatus;
+import ch.qos.logback.core.status.InfoStatus;
+import ch.qos.logback.core.status.WarnStatus;
+import ch.qos.logback.core.util.OptionHelper;
+
+/**
+ * This class is logback's implementation of jetty's RequestLog interface.
+ * It can be seen as logback classic's LoggerContext. Appenders can be attached
+ * directly to RequestLogImpl and RequestLogImpl uses the same StatusManager as
+ * LoggerContext does. It also provides containers for properties.
To
+ * configure jetty in order to use RequestLogImpl, the following lines must be
+ * added to the jetty configuration file, namely etc/jetty.xml:
+ *
+ *
+ *
+ * By default, RequestLogImpl looks for a logback configuration file called
+ * logback-access.xml, in the same folder where jetty.xml is located, that is
+ * etc/logback-access.xml. The logback-access.xml file is slightly
+ * different than the usual logback classic configuration file. Most of it is
+ * the same: Appenders and Layouts are declared the exact same way. However,
+ * loggers elements are not allowed.
It is possible to put the logback
+ * configuration file anywhere, as long as it's path is specified. Here is
+ * another example, with a path to the logback-access.xml file.
+ *
+ *
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public class RequestLogImpl extends ContextBase implements RequestLog,
+ AppenderAttachable, FilterAttachable {
+
+ public final static String DEFAULT_CONFIG_FILE = "etc" + File.separatorChar
+ + "logback-access.xml";
+
+ AppenderAttachableImpl aai = new AppenderAttachableImpl();
+ FilterAttachableImpl fai = new FilterAttachableImpl();
+ String filename;
+ boolean started = false;
+
+ public RequestLogImpl() {
+ putObject(CoreConstants.EVALUATOR_MAP, new HashMap());
+ }
+
+ public void log(Request jettyRequest, Response jettyResponse) {
+ JettyServerAdapter adapter = new JettyServerAdapter(jettyRequest,
+ jettyResponse);
+ AccessEvent accessEvent = new AccessEvent(jettyRequest, jettyResponse,
+ adapter);
+ if (getFilterChainDecision(accessEvent) == FilterReply.DENY) {
+ return;
+ }
+ aai.appendLoopOnAppenders(accessEvent);
+ }
+
+ public void start() {
+ if (filename == null) {
+ String jettyHomeProperty = OptionHelper.getSystemProperty("jetty.home");
+
+ filename = jettyHomeProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
+ getStatusManager().add(
+ new WarnStatus("filename property not set. Assuming [" + filename
+ + "]", this));
+
+ }
+ try {
+ File configFile = new File(filename);
+ if (configFile.exists()) {
+ JoranConfigurator jc = new JoranConfigurator();
+ jc.setContext(this);
+ jc.doConfigure(filename);
+
+ } else {
+ getStatusManager().add(
+ new ErrorStatus("[" + filename + "] does not exist", this));
+ }
+
+ if (getName() == null) {
+ setName("LogbackRequestLog");
+ }
+ RequestLogRegistry.register(this);
+ getStatusManager().add(
+ new InfoStatus("RequestLog added to RequestLogRegistry with name: "
+ + getName(), this));
+
+ started = true;
+
+ } catch (JoranException e) {
+ // errors have been registered as status messages
+ }
+ }
+
+ public void stop() {
+ aai.detachAndStopAllAppenders();
+ started = false;
+ }
+
+ public boolean isRunning() {
+ return started;
+ }
+
+ public void setFileName(String filename) {
+ this.filename = filename;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public boolean isStarting() {
+ return false;
+ }
+
+ public boolean isStopping() {
+ return false;
+ }
+
+ public boolean isStopped() {
+ return !started;
+ }
+
+ public boolean isFailed() {
+ return false;
+ }
+
+ public void addAppender(Appender newAppender) {
+ aai.addAppender(newAppender);
+ }
+
+ public Iterator> iteratorForAppenders() {
+ return aai.iteratorForAppenders();
+ }
+
+ public Appender getAppender(String name) {
+ return aai.getAppender(name);
+ }
+
+ public boolean isAttached(Appender appender) {
+ return aai.isAttached(appender);
+ }
+
+ public void detachAndStopAllAppenders() {
+ aai.detachAndStopAllAppenders();
+
+ }
+
+ public boolean detachAppender(Appender appender) {
+ return aai.detachAppender(appender);
+ }
+
+ public boolean detachAppender(String name) {
+ return aai.detachAppender(name);
+ }
+
+ public void addFilter(Filter newFilter) {
+ fai.addFilter(newFilter);
+ }
+
+ public void clearAllFilters() {
+ fai.clearAllFilters();
+ }
+
+ public List> getCopyOfAttachedFiltersList() {
+ return fai.getCopyOfAttachedFiltersList();
+ }
+
+ public FilterReply getFilterChainDecision(AccessEvent event) {
+ return fai.getFilterChainDecision(event);
+ }
+
+ public Filter getFirstFilter() {
+ return fai.getFirstFilter();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogRegistry.java b/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogRegistry.java
index e1415bea1d8f682ad98ada3e69fbdccdf13718f9..53d40d28b302fcc1273214afd787b662923aa2e6 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogRegistry.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/jetty/RequestLogRegistry.java
@@ -1,31 +1,31 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.jetty;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class RequestLogRegistry {
-
- private static Map requestLogRegistry = new HashMap();
-
- public static void register(RequestLogImpl requestLogImpl) {
- requestLogRegistry.put(requestLogImpl.getName(), requestLogImpl);
- }
-
- public static RequestLogImpl get(String key) {
- return requestLogRegistry.get(key);
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.jetty;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class RequestLogRegistry {
+
+ private static Map requestLogRegistry = new HashMap();
+
+ public static void register(RequestLogImpl requestLogImpl) {
+ requestLogRegistry.put(requestLogImpl.getName(), requestLogImpl);
+ }
+
+ public static RequestLogImpl get(String key) {
+ return requestLogRegistry.get(key);
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/jetty/package.html b/logback-access/src/main/java/ch/qos/logback/access/jetty/package.html
index 67095980f0ca50c149e05c9a88f43aca70509488..20a34c34fdd9e64ed4216b46db0d7d2d76010ec4 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/jetty/package.html
+++ b/logback-access/src/main/java/ch/qos/logback/access/jetty/package.html
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
This is logback access' implementation for Jetty.
-
-
+
+
+
+
+
+
+
+
+
+
This is logback access' implementation for Jetty.
+
+
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/joran/action/ConfigurationAction.java b/logback-access/src/main/java/ch/qos/logback/access/joran/action/ConfigurationAction.java
index 25c1551e351ff5020d1c9bd16ed627b55a35ae5f..ed776dc6b8bd3f608b0f3c08cd16f64c2734caea 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/joran/action/ConfigurationAction.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/joran/action/ConfigurationAction.java
@@ -1,51 +1,51 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.joran.action;
-
-import org.xml.sax.Attributes;
-
-import ch.qos.logback.core.joran.action.Action;
-import ch.qos.logback.core.joran.spi.InterpretationContext;
-import ch.qos.logback.core.util.StatusPrinter;
-
-
-
-public class ConfigurationAction extends Action {
- static final String INTERNAL_DEBUG_ATTR = "debug";
- boolean debugMode = false;
-
- public void begin(InterpretationContext ec, String name, Attributes attributes) {
- String debugAttrib = attributes.getValue(INTERNAL_DEBUG_ATTR);
-
- if (
- (debugAttrib == null) || debugAttrib.equals("")
- || debugAttrib.equals("false") || debugAttrib.equals("null")) {
- addInfo("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
- } else {
- debugMode = true;
- }
-
- // the context is appender attachable, so it is pushed on top of the stack
- ec.pushObject(getContext());
- }
-
- public void end(InterpretationContext ec, String name) {
- addInfo("End of configuration.");
- if (debugMode) {
- StatusPrinter.print(context);
- }
-
- ec.popObject();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.joran.action;
+
+import org.xml.sax.Attributes;
+
+import ch.qos.logback.core.joran.action.Action;
+import ch.qos.logback.core.joran.spi.InterpretationContext;
+import ch.qos.logback.core.util.StatusPrinter;
+
+
+
+public class ConfigurationAction extends Action {
+ static final String INTERNAL_DEBUG_ATTR = "debug";
+ boolean debugMode = false;
+
+ public void begin(InterpretationContext ec, String name, Attributes attributes) {
+ String debugAttrib = attributes.getValue(INTERNAL_DEBUG_ATTR);
+
+ if (
+ (debugAttrib == null) || debugAttrib.equals("")
+ || debugAttrib.equals("false") || debugAttrib.equals("null")) {
+ addInfo("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
+ } else {
+ debugMode = true;
+ }
+
+ // the context is appender attachable, so it is pushed on top of the stack
+ ec.pushObject(getContext());
+ }
+
+ public void end(InterpretationContext ec, String name) {
+ addInfo("End of configuration.");
+ if (debugMode) {
+ StatusPrinter.print(context);
+ }
+
+ ec.popObject();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/joran/action/EvaluatorAction.java b/logback-access/src/main/java/ch/qos/logback/access/joran/action/EvaluatorAction.java
index 852a88ce95c0b2925e347104eccf1f3908354ae5..7083dec3b4f939c15524d21105d86f3cc7bdd717 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/joran/action/EvaluatorAction.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/joran/action/EvaluatorAction.java
@@ -1,25 +1,25 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.joran.action;
-
-import ch.qos.logback.access.boolex.JaninoEventEvaluator;
-import ch.qos.logback.core.joran.action.AbstractEventEvaluatorAction;
-
-
-public class EvaluatorAction extends AbstractEventEvaluatorAction {
-
- protected String defaultClassName() {
- return JaninoEventEvaluator.class.getName();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.joran.action;
+
+import ch.qos.logback.access.boolex.JaninoEventEvaluator;
+import ch.qos.logback.core.joran.action.AbstractEventEvaluatorAction;
+
+
+public class EvaluatorAction extends AbstractEventEvaluatorAction {
+
+ protected String defaultClassName() {
+ return JaninoEventEvaluator.class.getName();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/joran/package.html b/logback-access/src/main/java/ch/qos/logback/access/joran/package.html
index 273b137885afd298c68fd7b83693a21f1c6c5fad..3955b621f0d145c2eb22482c1b74a136bfcf4b04 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/joran/package.html
+++ b/logback-access/src/main/java/ch/qos/logback/access/joran/package.html
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
Contains the Joran configration classes
-
-
+
+
+
+
+
+
+
+
+
+
Contains the Joran configration classes
+
+
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/AccessEventPreSerializationTransformer.java b/logback-access/src/main/java/ch/qos/logback/access/net/AccessEventPreSerializationTransformer.java
index 280a45433d7a38f709be168b795447988da1ea3a..567867159cd30230f39610591dc115edd1a15510 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/AccessEventPreSerializationTransformer.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/AccessEventPreSerializationTransformer.java
@@ -1,28 +1,28 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.net;
-
-import java.io.Serializable;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.spi.PreSerializationTransformer;
-
-public class AccessEventPreSerializationTransformer implements
- PreSerializationTransformer {
-
- public Serializable transform(AccessEvent event) {
- return event;
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.net;
+
+import java.io.Serializable;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.spi.PreSerializationTransformer;
+
+public class AccessEventPreSerializationTransformer implements
+ PreSerializationTransformer {
+
+ public Serializable transform(AccessEvent event) {
+ return event;
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java b/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
index b54e88b5af57d297e70f7c38f5e5b19650df212a..13477e923330a628fedc12bea8509309f856a9fa 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java
@@ -1,105 +1,105 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.net;
-
-import ch.qos.logback.access.PatternLayout;
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.Layout;
-import ch.qos.logback.core.boolex.EventEvaluator;
-import ch.qos.logback.core.helpers.CyclicBuffer;
-import ch.qos.logback.core.net.SMTPAppenderBase;
-
-/**
- * Send an e-mail when a specific access event occurs, typically when
- * certain pages are accessed.
- *
- * For more information about this appender, please refer to the online manual at
- * http://logback.qos.ch/manual/appenders.html#AccessSMTPAppender
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- *
- */
-public class SMTPAppender extends SMTPAppenderBase {
-
- static final String DEFAULT_SUBJECT_PATTERN = "%m";
-
- private int bufferSize = 512;
- protected CyclicBuffer cb = new CyclicBuffer(bufferSize);
-
- /**
- * The default constructor will instantiate the appender with a
- * {@link EventEvaluator} that will trigger on events with level
- * ERROR or higher.
- */
- public SMTPAppender() {
- }
-
- /**
- * Use evaluator passed as parameter as the {@link
- * EventEvaluator} for this SMTPAppender.
- */
- public SMTPAppender(EventEvaluator evaluator) {
- this.eventEvaluator = evaluator;
- }
-
- /**
- * Perform SMTPAppender specific appending actions, mainly adding the event to
- * a cyclic buffer.
- */
- protected void subAppend(AccessEvent event) {
- cb.add(event);
- // addInfo("Added event to the cyclic buffer: " + event.getMessage());
- }
-
- @Override
- protected void fillBuffer(StringBuffer sbuf) {
- int len = cb.length();
- for (int i = 0; i < len; i++) {
- // sbuf.append(MimeUtility.encodeText(layout.format(cb.get())));
- AccessEvent event = (AccessEvent) cb.get();
- sbuf.append(layout.doLayout(event));
- }
- }
-
- /**
- * The BufferSize option takes a positive integer representing the
- * maximum number of logging events to collect in a cyclic buffer. When the
- * BufferSize is reached, oldest events are deleted as new
- * events are added to the buffer. By default the size of the cyclic buffer is
- * 512 events.
- */
- public void setBufferSize(int bufferSize) {
- this.bufferSize = bufferSize;
- cb.resize(bufferSize);
- }
-
- /**
- * Returns value of the BufferSize option.
- */
- public int getBufferSize() {
- return bufferSize;
- }
-
- @Override
- protected Layout makeSubjectLayout(String subjectStr) {
- if(subjectStr == null) {
- subjectStr = DEFAULT_SUBJECT_PATTERN;
- }
- PatternLayout pl = new PatternLayout();
- pl.setPattern(subjectStr);
- pl.start();
- return pl;
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.net;
+
+import ch.qos.logback.access.PatternLayout;
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.Layout;
+import ch.qos.logback.core.boolex.EventEvaluator;
+import ch.qos.logback.core.helpers.CyclicBuffer;
+import ch.qos.logback.core.net.SMTPAppenderBase;
+
+/**
+ * Send an e-mail when a specific access event occurs, typically when
+ * certain pages are accessed.
+ *
+ * For more information about this appender, please refer to the online manual at
+ * http://logback.qos.ch/manual/appenders.html#AccessSMTPAppender
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ *
+ */
+public class SMTPAppender extends SMTPAppenderBase {
+
+ static final String DEFAULT_SUBJECT_PATTERN = "%m";
+
+ private int bufferSize = 512;
+ protected CyclicBuffer cb = new CyclicBuffer(bufferSize);
+
+ /**
+ * The default constructor will instantiate the appender with a
+ * {@link EventEvaluator} that will trigger on events with level
+ * ERROR or higher.
+ */
+ public SMTPAppender() {
+ }
+
+ /**
+ * Use evaluator passed as parameter as the {@link
+ * EventEvaluator} for this SMTPAppender.
+ */
+ public SMTPAppender(EventEvaluator evaluator) {
+ this.eventEvaluator = evaluator;
+ }
+
+ /**
+ * Perform SMTPAppender specific appending actions, mainly adding the event to
+ * a cyclic buffer.
+ */
+ protected void subAppend(AccessEvent event) {
+ cb.add(event);
+ // addInfo("Added event to the cyclic buffer: " + event.getMessage());
+ }
+
+ @Override
+ protected void fillBuffer(StringBuffer sbuf) {
+ int len = cb.length();
+ for (int i = 0; i < len; i++) {
+ // sbuf.append(MimeUtility.encodeText(layout.format(cb.get())));
+ AccessEvent event = (AccessEvent) cb.get();
+ sbuf.append(layout.doLayout(event));
+ }
+ }
+
+ /**
+ * The BufferSize option takes a positive integer representing the
+ * maximum number of logging events to collect in a cyclic buffer. When the
+ * BufferSize is reached, oldest events are deleted as new
+ * events are added to the buffer. By default the size of the cyclic buffer is
+ * 512 events.
+ */
+ public void setBufferSize(int bufferSize) {
+ this.bufferSize = bufferSize;
+ cb.resize(bufferSize);
+ }
+
+ /**
+ * Returns value of the BufferSize option.
+ */
+ public int getBufferSize() {
+ return bufferSize;
+ }
+
+ @Override
+ protected Layout makeSubjectLayout(String subjectStr) {
+ if(subjectStr == null) {
+ subjectStr = DEFAULT_SUBJECT_PATTERN;
+ }
+ PatternLayout pl = new PatternLayout();
+ pl.setPattern(subjectStr);
+ pl.start();
+ return pl;
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/URLEvaluator.java b/logback-access/src/main/java/ch/qos/logback/access/net/URLEvaluator.java
index e230aa7f4578b12369fddb34bfd0122413b7a918..b20133bb7bdcb12d02d13678976fe1410ee84ebf 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/URLEvaluator.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/URLEvaluator.java
@@ -1,72 +1,72 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.net;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.boolex.EvaluationException;
-import ch.qos.logback.core.boolex.EventEvaluator;
-import ch.qos.logback.core.spi.ContextAwareBase;
-import ch.qos.logback.core.spi.LifeCycle;
-
-public class URLEvaluator extends ContextAwareBase implements EventEvaluator, LifeCycle {
-
- boolean started;
- String name;
- private List URLList = new ArrayList();
-
- public URLEvaluator() {
- }
-
- public void addURL(String url) {
- URLList.add(url);
- }
-
- public void start() {
- if (URLList.size() == 0) {
- addWarn("No URL was given to URLEvaluator");
- } else {
- started = true;
- }
- }
-
- public boolean evaluate(Object eventObject) throws NullPointerException, EvaluationException {
- AccessEvent event = (AccessEvent)eventObject;
- String url = event.getRequestURL();
- for(String expected:URLList) {
- if (url.contains(expected)) {
- return true;
- }
- }
- return false;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public boolean isStarted() {
- return started;
- }
-
- public void stop() {
- started = false;
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.net;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.boolex.EvaluationException;
+import ch.qos.logback.core.boolex.EventEvaluator;
+import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.spi.LifeCycle;
+
+public class URLEvaluator extends ContextAwareBase implements EventEvaluator, LifeCycle {
+
+ boolean started;
+ String name;
+ private List URLList = new ArrayList();
+
+ public URLEvaluator() {
+ }
+
+ public void addURL(String url) {
+ URLList.add(url);
+ }
+
+ public void start() {
+ if (URLList.size() == 0) {
+ addWarn("No URL was given to URLEvaluator");
+ } else {
+ started = true;
+ }
+ }
+
+ public boolean evaluate(Object eventObject) throws NullPointerException, EvaluationException {
+ AccessEvent event = (AccessEvent)eventObject;
+ String url = event.getRequestURL();
+ for(String expected:URLList) {
+ if (url.contains(expected)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public void stop() {
+ started = false;
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/package.html b/logback-access/src/main/java/ch/qos/logback/access/package.html
index 012a1e37e5c2348f9d9ea0c5aef9791982e759b0..5755fc496868950e6076d2e6d92f91f04ce88bbc 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/package.html
+++ b/logback-access/src/main/java/ch/qos/logback/access/package.html
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
This is logback access' main package.
-
-
+
+
+
+
+
+
+
+
+
+
This is logback access' main package.
+
+
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/AccessConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/AccessConverter.java
index 853c84149121d68ebb5c5c0dbf0d6255f5bf261d..341562bb161f9461e2cffd2d9caf835c8964ac80 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/AccessConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/AccessConverter.java
@@ -1,67 +1,67 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.Context;
-import ch.qos.logback.core.pattern.DynamicConverter;
-import ch.qos.logback.core.spi.ContextAware;
-import ch.qos.logback.core.spi.ContextAwareBase;
-import ch.qos.logback.core.status.Status;
-
-
-abstract public class AccessConverter extends DynamicConverter implements ContextAware {
-
- public final static char SPACE_CHAR = ' ';
- public final static char QUESTION_CHAR = '?';
-
- ContextAwareBase cab = new ContextAwareBase();
-
- public void setContext(Context context) {
- cab.setContext(context);
- }
-
- public Context getContext() {
- return cab.getContext();
- }
-
- public void addStatus(Status status) {
- cab.addStatus(status);
- }
-
- public void addInfo(String msg) {
- cab.addInfo(msg);
- }
-
- public void addInfo(String msg, Throwable ex) {
- cab.addInfo(msg, ex);
- }
-
- public void addWarn(String msg) {
- cab.addWarn(msg);
- }
-
- public void addWarn(String msg, Throwable ex) {
- cab.addWarn(msg, ex);
- }
-
- public void addError(String msg) {
- addError(msg);
- }
-
- public void addError(String msg, Throwable ex) {
- addError(msg, ex);
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.pattern.DynamicConverter;
+import ch.qos.logback.core.spi.ContextAware;
+import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.status.Status;
+
+
+abstract public class AccessConverter extends DynamicConverter implements ContextAware {
+
+ public final static char SPACE_CHAR = ' ';
+ public final static char QUESTION_CHAR = '?';
+
+ ContextAwareBase cab = new ContextAwareBase();
+
+ public void setContext(Context context) {
+ cab.setContext(context);
+ }
+
+ public Context getContext() {
+ return cab.getContext();
+ }
+
+ public void addStatus(Status status) {
+ cab.addStatus(status);
+ }
+
+ public void addInfo(String msg) {
+ cab.addInfo(msg);
+ }
+
+ public void addInfo(String msg, Throwable ex) {
+ cab.addInfo(msg, ex);
+ }
+
+ public void addWarn(String msg) {
+ cab.addWarn(msg);
+ }
+
+ public void addWarn(String msg, Throwable ex) {
+ cab.addWarn(msg, ex);
+ }
+
+ public void addError(String msg) {
+ addError(msg);
+ }
+
+ public void addError(String msg, Throwable ex) {
+ addError(msg, ex);
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/ContentLengthConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/ContentLengthConverter.java
index 4453aaa6c04e011ed13a4834296d73b42a6dbc47..c88298c6c5c5dd2bc32a16a6e1be342985765ff2 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/ContentLengthConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/ContentLengthConverter.java
@@ -1,29 +1,29 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class ContentLengthConverter extends AccessConverter {
-
- public String convert(AccessEvent accessEvent) {
- long len = accessEvent.getContentLength();
- if(len == AccessEvent.SENTINEL) {
- return AccessEvent.NA;
- } else {
- return Long.toString(len);
- }
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class ContentLengthConverter extends AccessConverter {
+
+ public String convert(AccessEvent accessEvent) {
+ long len = accessEvent.getContentLength();
+ if(len == AccessEvent.SENTINEL) {
+ return AccessEvent.NA;
+ } else {
+ return Long.toString(len);
+ }
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java
index fb6a39e5749025ceb4585d2bd5ee52f31219f8c9..23299bd480b077333241156e2228c1190873bb3d 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/DateConverter.java
@@ -1,77 +1,77 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.TimeZone;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.CoreConstants;
-
-
-
-public class DateConverter extends AccessConverter {
-
- long lastTimestamp = -1;
- String timesmapStr = null;
- SimpleDateFormat simpleFormat = null;
-
- public void start() {
-
- String datePattern = getFirstOption();
- if(datePattern == null) {
- datePattern = CoreConstants.CLF_DATE_PATTERN;
- }
-
- if (datePattern.equals(CoreConstants.ISO8601_STR)) {
- datePattern = CoreConstants.ISO8601_PATTERN;
- }
-
- try {
- simpleFormat = new SimpleDateFormat(datePattern);
- //maximumCacheValidity = CachedDateFormat.getMaximumCacheValidity(pattern);
- } catch (IllegalArgumentException e) {
- addWarn(
- "Could not instantiate SimpleDateFormat with pattern " + datePattern, e);
- // default to the ISO8601 format
- simpleFormat = new SimpleDateFormat(CoreConstants.CLF_DATE_PATTERN);
- }
-
- List optionList = getOptionList();
-
- // if the option list contains a TZ option, then set it.
- if (optionList != null && optionList.size() > 1) {
- TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1));
- simpleFormat.setTimeZone(tz);
- }
- }
-
-
- public String convert(AccessEvent accessEvent) {
-
- long timestamp = accessEvent.getTimeStamp();
-
- // if called multiple times within the same millisecond
- // return old value
- if(timestamp == lastTimestamp) {
- return timesmapStr;
- } else {
- lastTimestamp = timestamp;
- timesmapStr = simpleFormat.format(new Date(timestamp));
- return timesmapStr;
- }
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.CoreConstants;
+
+
+
+public class DateConverter extends AccessConverter {
+
+ long lastTimestamp = -1;
+ String timesmapStr = null;
+ SimpleDateFormat simpleFormat = null;
+
+ public void start() {
+
+ String datePattern = getFirstOption();
+ if(datePattern == null) {
+ datePattern = CoreConstants.CLF_DATE_PATTERN;
+ }
+
+ if (datePattern.equals(CoreConstants.ISO8601_STR)) {
+ datePattern = CoreConstants.ISO8601_PATTERN;
+ }
+
+ try {
+ simpleFormat = new SimpleDateFormat(datePattern);
+ //maximumCacheValidity = CachedDateFormat.getMaximumCacheValidity(pattern);
+ } catch (IllegalArgumentException e) {
+ addWarn(
+ "Could not instantiate SimpleDateFormat with pattern " + datePattern, e);
+ // default to the ISO8601 format
+ simpleFormat = new SimpleDateFormat(CoreConstants.CLF_DATE_PATTERN);
+ }
+
+ List optionList = getOptionList();
+
+ // if the option list contains a TZ option, then set it.
+ if (optionList != null && optionList.size() > 1) {
+ TimeZone tz = TimeZone.getTimeZone((String) optionList.get(1));
+ simpleFormat.setTimeZone(tz);
+ }
+ }
+
+
+ public String convert(AccessEvent accessEvent) {
+
+ long timestamp = accessEvent.getTimeStamp();
+
+ // if called multiple times within the same millisecond
+ // return old value
+ if(timestamp == lastTimestamp) {
+ return timesmapStr;
+ } else {
+ lastTimestamp = timestamp;
+ timesmapStr = simpleFormat.format(new Date(timestamp));
+ return timesmapStr;
+ }
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/EnsureLineSeparation.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/EnsureLineSeparation.java
index 725ceda203e53ab2685ea37bee5682defa67c8bc..abc7f99afaeff75b32a40f95fd8acc2d8cca91fb 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/EnsureLineSeparation.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/EnsureLineSeparation.java
@@ -1,38 +1,38 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.pattern.Converter;
-import ch.qos.logback.core.pattern.ConverterUtil;
-import ch.qos.logback.core.pattern.PostCompileProcessor;
-
-public class EnsureLineSeparation implements PostCompileProcessor {
-
- /**
- * Add a line separator converter so that access event appears on a separate
- * line.
- */
- public void process(Converter head) {
- Converter tail = ConverterUtil.findTail(head);
- Converter newLineConverter = new LineSeparatorConverter();
- if (tail == null) {
- head = newLineConverter;
- } else {
- if (!(tail instanceof LineSeparatorConverter)) {
- tail.setNext(newLineConverter);
- }
- }
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.pattern.Converter;
+import ch.qos.logback.core.pattern.ConverterUtil;
+import ch.qos.logback.core.pattern.PostCompileProcessor;
+
+public class EnsureLineSeparation implements PostCompileProcessor {
+
+ /**
+ * Add a line separator converter so that access event appears on a separate
+ * line.
+ */
+ public void process(Converter head) {
+ Converter tail = ConverterUtil.findTail(head);
+ Converter newLineConverter = new LineSeparatorConverter();
+ if (tail == null) {
+ head = newLineConverter;
+ } else {
+ if (!(tail instanceof LineSeparatorConverter)) {
+ tail.setNext(newLineConverter);
+ }
+ }
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/FullRequestConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/FullRequestConverter.java
index 0c4cdc1201ec6de673e48f84fa19d0ab0dd526e6..9ece66b0eee0e826b3f7f126510ed06c15855423 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/FullRequestConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/FullRequestConverter.java
@@ -1,51 +1,51 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import java.util.Enumeration;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.CoreConstants;
-
-/**
- * This class is tied to the fullRequest conversion word.
- *
- * It has been removed from the {@link ch.qos.logback.access.PatternLayout} since
- * it needs further testing before wide use.
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public class FullRequestConverter extends AccessConverter {
-
- @Override
- public String convert(AccessEvent ae) {
- StringBuffer buf = new StringBuffer();
- buf.append(ae.getRequestURL());
- buf.append(CoreConstants.LINE_SEPARATOR);
-
- Enumeration headerNames = ae.getRequestHeaderNames();
- while(headerNames.hasMoreElements()) {
- String name = (String) headerNames.nextElement();
- buf.append(name);
- buf.append(": ");
- buf.append(ae.getRequestHeader(name));
- buf.append(CoreConstants.LINE_SEPARATOR);
- }
- buf.append(CoreConstants.LINE_SEPARATOR);
- buf.append(ae.getRequestContent());
- return buf.toString();
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import java.util.Enumeration;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.CoreConstants;
+
+/**
+ * This class is tied to the fullRequest conversion word.
+ *
+ * It has been removed from the {@link ch.qos.logback.access.PatternLayout} since
+ * it needs further testing before wide use.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public class FullRequestConverter extends AccessConverter {
+
+ @Override
+ public String convert(AccessEvent ae) {
+ StringBuffer buf = new StringBuffer();
+ buf.append(ae.getRequestURL());
+ buf.append(CoreConstants.LINE_SEPARATOR);
+
+ Enumeration headerNames = ae.getRequestHeaderNames();
+ while(headerNames.hasMoreElements()) {
+ String name = (String) headerNames.nextElement();
+ buf.append(name);
+ buf.append(": ");
+ buf.append(ae.getRequestHeader(name));
+ buf.append(CoreConstants.LINE_SEPARATOR);
+ }
+ buf.append(CoreConstants.LINE_SEPARATOR);
+ buf.append(ae.getRequestContent());
+ return buf.toString();
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/FullResponseConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/FullResponseConverter.java
index 34c3e20b993dbaaff1ac9cfe8e7054079c5af80e..de9e25e5baece4e761109b90f5c5e7f3d5b0b380 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/FullResponseConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/FullResponseConverter.java
@@ -1,91 +1,91 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import java.util.List;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.CoreConstants;
-
-public class FullResponseConverter extends AccessConverter {
-
- @Override
- public String convert(AccessEvent ae) {
- StringBuffer buf = new StringBuffer();
-
- buf.append("HTTP/1.1 ");
- int statusCode = ae.getStatusCode();
- buf.append(statusCode);
- buf.append(" ");
- buf.append(getStatusCodeDescription(statusCode));
- buf.append(CoreConstants.LINE_SEPARATOR);
-
- List hnList = ae.getResponseHeaderNameList();
- for(String headerName: hnList) {
- buf.append(headerName);
- buf.append(": ");
- buf.append(ae.getResponseHeader(headerName));
- buf.append(CoreConstants.LINE_SEPARATOR);
- }
- buf.append(CoreConstants.LINE_SEPARATOR);
- buf.append(ae.getResponseContent());
- buf.append(CoreConstants.LINE_SEPARATOR);
- return buf.toString();
- }
-
- static String getStatusCodeDescription(int sc) {
- switch(sc) {
- case 200: return "OK";
- case 201: return "Created";
- case 202: return "Accepted";
- case 203: return "Non-Authoritative Information";
- case 204: return "No Content";
- case 205: return "Reset Content";
- case 206: return "Partial Content";
- case 300: return "Multiple Choices";
- case 301: return "Moved Permanently";
- case 302: return "Found";
- case 303: return "See Other";
- case 304: return "Not Modified";
- case 305: return "Use Proxy";
- case 306: return "(Unused)";
- case 307: return "Temporary Redirect";
- case 400: return "Bad Request";
- case 401: return "Unauthorized";
- case 402: return "Payment Required";
- case 403: return "Forbidden";
- case 404: return "Not Found";
- case 405: return "Method Not Allowed";
- case 406: return "Not Acceptable";
- case 407: return "Proxy Authentication Required";
- case 408: return "Request Timeout";
- case 409: return "Conflict";
- case 410: return "Gone";
- case 411: return "Length Required";
- case 412: return "Precondition Failed";
- case 413: return "Request Entity Too Large";
- case 414: return "Request-URI Too Long";
- case 415: return "Unsupported Media Type";
- case 416: return "Requested Range Not Satisfiable";
- case 417: return "Expectation Failed";
- case 500: return "Internal Server Error";
- case 501: return "Not Implemented";
- case 502: return "Bad Gateway";
- case 503: return "Service Unavailable";
- case 504: return "Gateway Timeout";
- case 505: return "HTTP Version Not Supported";
- default: return "NA";
- }
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import java.util.List;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.CoreConstants;
+
+public class FullResponseConverter extends AccessConverter {
+
+ @Override
+ public String convert(AccessEvent ae) {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append("HTTP/1.1 ");
+ int statusCode = ae.getStatusCode();
+ buf.append(statusCode);
+ buf.append(" ");
+ buf.append(getStatusCodeDescription(statusCode));
+ buf.append(CoreConstants.LINE_SEPARATOR);
+
+ List hnList = ae.getResponseHeaderNameList();
+ for(String headerName: hnList) {
+ buf.append(headerName);
+ buf.append(": ");
+ buf.append(ae.getResponseHeader(headerName));
+ buf.append(CoreConstants.LINE_SEPARATOR);
+ }
+ buf.append(CoreConstants.LINE_SEPARATOR);
+ buf.append(ae.getResponseContent());
+ buf.append(CoreConstants.LINE_SEPARATOR);
+ return buf.toString();
+ }
+
+ static String getStatusCodeDescription(int sc) {
+ switch(sc) {
+ case 200: return "OK";
+ case 201: return "Created";
+ case 202: return "Accepted";
+ case 203: return "Non-Authoritative Information";
+ case 204: return "No Content";
+ case 205: return "Reset Content";
+ case 206: return "Partial Content";
+ case 300: return "Multiple Choices";
+ case 301: return "Moved Permanently";
+ case 302: return "Found";
+ case 303: return "See Other";
+ case 304: return "Not Modified";
+ case 305: return "Use Proxy";
+ case 306: return "(Unused)";
+ case 307: return "Temporary Redirect";
+ case 400: return "Bad Request";
+ case 401: return "Unauthorized";
+ case 402: return "Payment Required";
+ case 403: return "Forbidden";
+ case 404: return "Not Found";
+ case 405: return "Method Not Allowed";
+ case 406: return "Not Acceptable";
+ case 407: return "Proxy Authentication Required";
+ case 408: return "Request Timeout";
+ case 409: return "Conflict";
+ case 410: return "Gone";
+ case 411: return "Length Required";
+ case 412: return "Precondition Failed";
+ case 413: return "Request Entity Too Large";
+ case 414: return "Request-URI Too Long";
+ case 415: return "Unsupported Media Type";
+ case 416: return "Requested Range Not Satisfiable";
+ case 417: return "Expectation Failed";
+ case 500: return "Internal Server Error";
+ case 501: return "Not Implemented";
+ case 502: return "Bad Gateway";
+ case 503: return "Service Unavailable";
+ case 504: return "Gateway Timeout";
+ case 505: return "HTTP Version Not Supported";
+ default: return "NA";
+ }
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/LineSeparatorConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/LineSeparatorConverter.java
index bc7016210dfd85bb67f34f3dd61543ab045f5897..11f8d4681dd07c10b344405a68e8a09818095964 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/LineSeparatorConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/LineSeparatorConverter.java
@@ -1,25 +1,25 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.CoreConstants;
-
-
-public class LineSeparatorConverter extends AccessConverter {
-
- public String convert(AccessEvent event) {
- return CoreConstants.LINE_SEPARATOR;
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.CoreConstants;
+
+
+public class LineSeparatorConverter extends AccessConverter {
+
+ public String convert(AccessEvent event) {
+ return CoreConstants.LINE_SEPARATOR;
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/LocalIPAddressConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/LocalIPAddressConverter.java
index b2a7210f3a8063d086e4d3dc7f51378a4a65fab9..38087aadd35171e40fa79451641e835f9ad7cfa4 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/LocalIPAddressConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/LocalIPAddressConverter.java
@@ -1,37 +1,37 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class LocalIPAddressConverter extends AccessConverter {
-
- String localIPAddressStr;
-
- public LocalIPAddressConverter() {
- try {
- localIPAddressStr = InetAddress.getLocalHost().getHostAddress();
- } catch (UnknownHostException uhe) {
- localIPAddressStr = "127.0.0.1";
- }
- }
-
- public String convert(AccessEvent accessEvent) {
- return localIPAddressStr;
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class LocalIPAddressConverter extends AccessConverter {
+
+ String localIPAddressStr;
+
+ public LocalIPAddressConverter() {
+ try {
+ localIPAddressStr = InetAddress.getLocalHost().getHostAddress();
+ } catch (UnknownHostException uhe) {
+ localIPAddressStr = "127.0.0.1";
+ }
+ }
+
+ public String convert(AccessEvent accessEvent) {
+ return localIPAddressStr;
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/LocalPortConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/LocalPortConverter.java
index dcccb7cbee39295128acfd18f94ab750bf031fc1..8824253ef7d3df20054414a732c4cb3352e4272b 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/LocalPortConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/LocalPortConverter.java
@@ -1,24 +1,24 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class LocalPortConverter extends AccessConverter {
-
-
- public String convert(AccessEvent accessEvent) {
- return Integer.toString(accessEvent.getLocalPort());
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class LocalPortConverter extends AccessConverter {
+
+
+ public String convert(AccessEvent accessEvent) {
+ return Integer.toString(accessEvent.getLocalPort());
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/NAConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/NAConverter.java
index 7b5e00838c63ba4070bb6b9eb9eaf58c45d4c013..1a1271629b15fe877d212b82bd89b360e8d99d1c 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/NAConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/NAConverter.java
@@ -1,30 +1,30 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-/**
- * Always returns the NA (not available) string which is "-" in the case
- * of access conversions.
- *
- * @author Ceki Gülcü
- */
-public class NAConverter extends AccessConverter {
-
- public String convert(AccessEvent accessEvent) {
- return AccessEvent.NA;
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+/**
+ * Always returns the NA (not available) string which is "-" in the case
+ * of access conversions.
+ *
+ * @author Ceki Gülcü
+ */
+public class NAConverter extends AccessConverter {
+
+ public String convert(AccessEvent accessEvent) {
+ return AccessEvent.NA;
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteHostConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteHostConverter.java
index 2188daf815167efbb1b88c2c39b3301f5e3a6471..368a267b040103548a78cdbb049c48cd1e580c3f 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteHostConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteHostConverter.java
@@ -1,25 +1,25 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class RemoteHostConverter extends AccessConverter {
-
-
- public String convert(AccessEvent accessEvent) {
- return accessEvent.getRemoteHost();
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class RemoteHostConverter extends AccessConverter {
+
+
+ public String convert(AccessEvent accessEvent) {
+ return accessEvent.getRemoteHost();
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteIPAddressConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteIPAddressConverter.java
index 0c4cf2bd9a3eeb412bdad5cef5f6f610936868ad..caf09db40d2d5e78534be6ff3d618d30533e6dc2 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteIPAddressConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteIPAddressConverter.java
@@ -1,24 +1,24 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class RemoteIPAddressConverter extends AccessConverter {
-
- public String convert(AccessEvent accessEvent) {
- return accessEvent.getRemoteAddr();
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class RemoteIPAddressConverter extends AccessConverter {
+
+ public String convert(AccessEvent accessEvent) {
+ return accessEvent.getRemoteAddr();
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteUserConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteUserConverter.java
index dde4786c31cfd7276138c5450f56433eb3c950f2..c414e26933dda19c6c169f4018d06044a5b4dfb2 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteUserConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RemoteUserConverter.java
@@ -1,31 +1,31 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class RemoteUserConverter extends AccessConverter {
-
-
- public String convert(AccessEvent accessEvent) {
-
- String user = accessEvent.getRemoteUser();
- if(user == null) {
- return AccessEvent.NA;
- } else {
- return user;
- }
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class RemoteUserConverter extends AccessConverter {
+
+
+ public String convert(AccessEvent accessEvent) {
+
+ String user = accessEvent.getRemoteUser();
+ if(user == null) {
+ return AccessEvent.NA;
+ } else {
+ return user;
+ }
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestAttributeConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestAttributeConverter.java
index 7630108a7e346afa5c922d32ea6cb99d209f377b..253e47653a017c5034ddbe17df4c052c0811441d 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestAttributeConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestAttributeConverter.java
@@ -1,41 +1,41 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.util.OptionHelper;
-
-
-public class RequestAttributeConverter extends AccessConverter {
-
- String key;
-
- public void start() {
- key = getFirstOption();
- if (OptionHelper.isEmpty(key)) {
- addWarn("Missing key for the request attribute");
- } else {
- super.start();
- }
- }
-
- public String convert(AccessEvent accessEvent) {
- if (!isStarted()) {
- return "INACTIVE_REQUEST_ATTRIB_CONV";
- }
-
- return accessEvent.getAttribute(key);
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.util.OptionHelper;
+
+
+public class RequestAttributeConverter extends AccessConverter {
+
+ String key;
+
+ public void start() {
+ key = getFirstOption();
+ if (OptionHelper.isEmpty(key)) {
+ addWarn("Missing key for the request attribute");
+ } else {
+ super.start();
+ }
+ }
+
+ public String convert(AccessEvent accessEvent) {
+ if (!isStarted()) {
+ return "INACTIVE_REQUEST_ATTRIB_CONV";
+ }
+
+ return accessEvent.getAttribute(key);
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestContentConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestContentConverter.java
index 5683973378932b8b7ac57acfa1ece6fdcdfda40e..0cecce1cc0bd79dd3d5fba3209ccfa56a94e906f 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestContentConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestContentConverter.java
@@ -1,34 +1,34 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-/**
- * This class is tied to the requestContent conversion word.
- *
- * It has been removed from the {@link ch.qos.logback.access.PatternLayout} since
- * it needs further testing before wide use.
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public class RequestContentConverter extends AccessConverter {
-
- @Override
- public String convert(AccessEvent accessEvent) {
- return accessEvent.getRequestContent();
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+/**
+ * This class is tied to the requestContent conversion word.
+ *
+ * It has been removed from the {@link ch.qos.logback.access.PatternLayout} since
+ * it needs further testing before wide use.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public class RequestContentConverter extends AccessConverter {
+
+ @Override
+ public String convert(AccessEvent accessEvent) {
+ return accessEvent.getRequestContent();
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestCookieConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestCookieConverter.java
index 466bebea86433ea3cf373c2500e30d6a08eaf628..18f2fd854db12f8fd8f98b55285f68e1970a3ffd 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestCookieConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestCookieConverter.java
@@ -1,40 +1,40 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.util.OptionHelper;
-
-
-public class RequestCookieConverter extends AccessConverter {
-
- String key;
-
- public void start() {
- key = getFirstOption();
- if (OptionHelper.isEmpty(key)) {
- addWarn("Missing key for the requested header");
- } else {
- super.start();
- }
- }
-
- public String convert(AccessEvent accessEvent) {
- if (!isStarted()) {
- return "INACTIVE_COOKIE_CONVERTER";
- }
-
- return accessEvent.getCookie(key);
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.util.OptionHelper;
+
+
+public class RequestCookieConverter extends AccessConverter {
+
+ String key;
+
+ public void start() {
+ key = getFirstOption();
+ if (OptionHelper.isEmpty(key)) {
+ addWarn("Missing key for the requested header");
+ } else {
+ super.start();
+ }
+ }
+
+ public String convert(AccessEvent accessEvent) {
+ if (!isStarted()) {
+ return "INACTIVE_COOKIE_CONVERTER";
+ }
+
+ return accessEvent.getCookie(key);
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestHeaderConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestHeaderConverter.java
index 48695fefeb06f1bea5ad2b7dee829ec259935534..222b808b2c761bb7ad775689f93b402e552ec3dc 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestHeaderConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestHeaderConverter.java
@@ -1,45 +1,45 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.util.OptionHelper;
-
-
-public class RequestHeaderConverter extends AccessConverter {
-
- String key;
-
- public void start() {
- key = getFirstOption();
- if (OptionHelper.isEmpty(key)) {
- addWarn("Missing key for the requested header. Defaulting to all keys.");
- key = null;
- }
- super.start();
- }
-
- public String convert(AccessEvent accessEvent) {
- if(!isStarted()) {
- return "INACTIVE_HEADER_CONV";
- }
-
- if(key != null) {
- return accessEvent.getRequestHeader(key);
- } else {
- return accessEvent.getRequestHeaderMap().toString();
- }
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.util.OptionHelper;
+
+
+public class RequestHeaderConverter extends AccessConverter {
+
+ String key;
+
+ public void start() {
+ key = getFirstOption();
+ if (OptionHelper.isEmpty(key)) {
+ addWarn("Missing key for the requested header. Defaulting to all keys.");
+ key = null;
+ }
+ super.start();
+ }
+
+ public String convert(AccessEvent accessEvent) {
+ if(!isStarted()) {
+ return "INACTIVE_HEADER_CONV";
+ }
+
+ if(key != null) {
+ return accessEvent.getRequestHeader(key);
+ } else {
+ return accessEvent.getRequestHeaderMap().toString();
+ }
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestMethodConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestMethodConverter.java
index 90b863db70e42f853af65ba1ae7cd29fd05aed04..dfd77281891fd152c541ae6661d3b3caa87d3d29 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestMethodConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestMethodConverter.java
@@ -1,24 +1,24 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class RequestMethodConverter extends AccessConverter {
-
-
- public String convert(AccessEvent accessEvent) {
- return accessEvent.getMethod();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class RequestMethodConverter extends AccessConverter {
+
+
+ public String convert(AccessEvent accessEvent) {
+ return accessEvent.getMethod();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestParameterConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestParameterConverter.java
index 491a848b16b3c4135cdc19435513d6cd452a13c0..dee1d01d91501da291cd80fb2035b1691c02a912 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestParameterConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestParameterConverter.java
@@ -1,49 +1,49 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import java.util.Arrays;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.util.OptionHelper;
-
-public class RequestParameterConverter extends AccessConverter {
-
- String key;
-
- public void start() {
- key = getFirstOption();
- if (OptionHelper.isEmpty(key)) {
- addWarn("Missing key for the request parameter");
- } else {
- super.start();
- }
- }
-
- public String convert(AccessEvent accessEvent) {
- if (!isStarted()) {
- return "INACTIVE_REQUEST_PARAM_CONV";
- }
-
- String[] paramArray = accessEvent.getRequestParameter(key);
- if (paramArray.length == 1) {
- return paramArray[0];
- } else {
- // for an array string {"a", "b"} named 'sa', Array.toString(sa) returns the string
- // "[a, b]".
- return Arrays.toString(paramArray);
- }
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import java.util.Arrays;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.util.OptionHelper;
+
+public class RequestParameterConverter extends AccessConverter {
+
+ String key;
+
+ public void start() {
+ key = getFirstOption();
+ if (OptionHelper.isEmpty(key)) {
+ addWarn("Missing key for the request parameter");
+ } else {
+ super.start();
+ }
+ }
+
+ public String convert(AccessEvent accessEvent) {
+ if (!isStarted()) {
+ return "INACTIVE_REQUEST_PARAM_CONV";
+ }
+
+ String[] paramArray = accessEvent.getRequestParameter(key);
+ if (paramArray.length == 1) {
+ return paramArray[0];
+ } else {
+ // for an array string {"a", "b"} named 'sa', Array.toString(sa) returns the string
+ // "[a, b]".
+ return Arrays.toString(paramArray);
+ }
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestProtocolConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestProtocolConverter.java
index 6928cbca5da10ac60659b1ae8e56837372a297c2..06c03fbc52342d7d2eecbd6fb4966c354c28916e 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestProtocolConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestProtocolConverter.java
@@ -1,24 +1,24 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class RequestProtocolConverter extends AccessConverter {
-
-
- public String convert(AccessEvent accessEvent) {
- return accessEvent.getProtocol();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class RequestProtocolConverter extends AccessConverter {
+
+
+ public String convert(AccessEvent accessEvent) {
+ return accessEvent.getProtocol();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestURIConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestURIConverter.java
index 1af9e2cb6fd560138367185f55142acbe09a7596..2216f429a1368618ceb0513eb9f630b3b9be5365 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestURIConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestURIConverter.java
@@ -1,29 +1,29 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-/**
- * The request URI.
- *
- * @author Ceki Gülcü
- */
-public class RequestURIConverter extends AccessConverter {
-
- public String convert(AccessEvent accessEvent) {
- return accessEvent.getRequestURI();
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+/**
+ * The request URI.
+ *
+ * @author Ceki Gülcü
+ */
+public class RequestURIConverter extends AccessConverter {
+
+ public String convert(AccessEvent accessEvent) {
+ return accessEvent.getRequestURI();
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestURLConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestURLConverter.java
index e09e7089e3df61aed96b7cdcd7184321eae9ede0..5b035b7ae54eb4e791cc4517e1ac9e4348d82bc9 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestURLConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/RequestURLConverter.java
@@ -1,28 +1,28 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-/**
- * The first line of the request.
- *
- * @author Ceki Gülcü
- */
-public class RequestURLConverter extends AccessConverter {
-
- public String convert(AccessEvent accessEvent) {
- return accessEvent.getRequestURL();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+/**
+ * The first line of the request.
+ *
+ * @author Ceki Gülcü
+ */
+public class RequestURLConverter extends AccessConverter {
+
+ public String convert(AccessEvent accessEvent) {
+ return accessEvent.getRequestURL();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/ResponseContentConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/ResponseContentConverter.java
index 26c9da5f5e8607e47ae72d547c2c8ebd1da9441c..9e0d6e784951d37a1866b4fb9779e08aa79f6a59 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/ResponseContentConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/ResponseContentConverter.java
@@ -1,34 +1,34 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-/**
- * This class is tied to the requestContent conversion word.
- *
- * It has been removed from the {@link ch.qos.logback.access.PatternLayout} since
- * it needs further testing before wide use.
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public class ResponseContentConverter extends AccessConverter {
-
- @Override
- public String convert(AccessEvent accessEvent) {
- return accessEvent.getResponseContent();
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+/**
+ * This class is tied to the requestContent conversion word.
+ *
+ * It has been removed from the {@link ch.qos.logback.access.PatternLayout} since
+ * it needs further testing before wide use.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public class ResponseContentConverter extends AccessConverter {
+
+ @Override
+ public String convert(AccessEvent accessEvent) {
+ return accessEvent.getResponseContent();
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/ResponseHeaderConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/ResponseHeaderConverter.java
index 5bfb581ba779a487e3d0a13ad42730a52494a3d5..5ebd3693d4b5d3e68ab48fbb8f01676946a996ea 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/ResponseHeaderConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/ResponseHeaderConverter.java
@@ -1,51 +1,51 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.util.OptionHelper;
-
-
-public class ResponseHeaderConverter extends AccessConverter {
-
- String key;
-
- public void start() {
- key = getFirstOption();
- if (OptionHelper.isEmpty(key)) {
- addWarn("Missing key for the response header");
- } else {
- super.start();
- }
- }
-
- public String convert(AccessEvent accessEvent) {
- if(!isStarted()) {
- return "INACTIVE_REPONSE_HEADER_CONV";
- }
-
- return accessEvent.getResponseHeader(key);
- //return null;
-
-// HttpServletResponse response = accessEvent.getHttpResponse();
-//
-// Object value = null; // = response.getHeader(key);
-// if (value == null) {
-// return AccessConverter.NA;
-// } else {
-// return value.toString();
-// }
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.util.OptionHelper;
+
+
+public class ResponseHeaderConverter extends AccessConverter {
+
+ String key;
+
+ public void start() {
+ key = getFirstOption();
+ if (OptionHelper.isEmpty(key)) {
+ addWarn("Missing key for the response header");
+ } else {
+ super.start();
+ }
+ }
+
+ public String convert(AccessEvent accessEvent) {
+ if(!isStarted()) {
+ return "INACTIVE_REPONSE_HEADER_CONV";
+ }
+
+ return accessEvent.getResponseHeader(key);
+ //return null;
+
+// HttpServletResponse response = accessEvent.getHttpResponse();
+//
+// Object value = null; // = response.getHeader(key);
+// if (value == null) {
+// return AccessConverter.NA;
+// } else {
+// return value.toString();
+// }
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/ServerNameConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/ServerNameConverter.java
index 5f5f277b0f0aff160db5464df4d6beaa60eabc36..33e1d2c41986e6dd45b92988fe210ab71a480830 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/ServerNameConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/ServerNameConverter.java
@@ -1,23 +1,23 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class ServerNameConverter extends AccessConverter {
-
- public String convert(AccessEvent accessEvent) {
- return accessEvent.getServerName();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class ServerNameConverter extends AccessConverter {
+
+ public String convert(AccessEvent accessEvent) {
+ return accessEvent.getServerName();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/StatusCodeConverter.java b/logback-access/src/main/java/ch/qos/logback/access/pattern/StatusCodeConverter.java
index 911ad1b6a455e49642b15bd74d0f5f012fa04c9e..52780028cfe3922d59ea568781d33070e329175d 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/StatusCodeConverter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/StatusCodeConverter.java
@@ -1,24 +1,24 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.pattern;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class StatusCodeConverter extends AccessConverter {
-
- public String convert(AccessEvent accessEvent) {
- return Integer.toString(accessEvent.getStatusCode());
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.pattern;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class StatusCodeConverter extends AccessConverter {
+
+ public String convert(AccessEvent accessEvent) {
+ return Integer.toString(accessEvent.getStatusCode());
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/pattern/package.html b/logback-access/src/main/java/ch/qos/logback/access/pattern/package.html
index de3614cbbe629d846d519d4a769b274f78eb9756..5e4898f941f7b16f49aadc822f2f45730b4cc757 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/pattern/package.html
+++ b/logback-access/src/main/java/ch/qos/logback/access/pattern/package.html
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
Provides classes implementing format specifiers in conversion patterns.
-
-
+
+
+
+
+
+
+
+
+
+
Provides classes implementing format specifiers in conversion patterns.
+
+
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeFilter.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeFilter.java
index bfae35ef77adf15d7a3a16e06296c905535fd8ad..346940386b37157cc6f593cb0c50511336121f9a 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeFilter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeFilter.java
@@ -1,71 +1,71 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.servlet;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import ch.qos.logback.access.AccessConstants;
-
-public class TeeFilter implements Filter {
-
- public void destroy() {
- // NOP
- }
-
- public void doFilter(ServletRequest request, ServletResponse response,
- FilterChain filterChain) throws IOException, ServletException {
-
- if (request instanceof HttpServletRequest) {
- try {
- TeeHttpServletRequest teeRequest = new TeeHttpServletRequest(
- (HttpServletRequest) request);
- TeeHttpServletResponse teeResponse = new TeeHttpServletResponse(
- (HttpServletResponse) response);
-
- //System.out.println("BEFORE TeeFilter. filterChain.doFilter()");
- filterChain.doFilter(teeRequest, teeResponse);
- //System.out.println("AFTER TeeFilter. filterChain.doFilter()");
-
- teeResponse.finish();
- // let the output contents be available for later use by
- // logback-access-logging
- teeRequest.setAttribute(AccessConstants.LB_OUTPUT_BUFFER, teeResponse
- .getOutputBuffer());
- } catch (IOException e) {
- e.printStackTrace();
- throw e;
- } catch (ServletException e) {
- e.printStackTrace();
- throw e;
- }
- } else {
- filterChain.doFilter(request, response);
- }
-
- }
-
- public void init(FilterConfig arg0) throws ServletException {
- // NOP
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import ch.qos.logback.access.AccessConstants;
+
+public class TeeFilter implements Filter {
+
+ public void destroy() {
+ // NOP
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain filterChain) throws IOException, ServletException {
+
+ if (request instanceof HttpServletRequest) {
+ try {
+ TeeHttpServletRequest teeRequest = new TeeHttpServletRequest(
+ (HttpServletRequest) request);
+ TeeHttpServletResponse teeResponse = new TeeHttpServletResponse(
+ (HttpServletResponse) response);
+
+ //System.out.println("BEFORE TeeFilter. filterChain.doFilter()");
+ filterChain.doFilter(teeRequest, teeResponse);
+ //System.out.println("AFTER TeeFilter. filterChain.doFilter()");
+
+ teeResponse.finish();
+ // let the output contents be available for later use by
+ // logback-access-logging
+ teeRequest.setAttribute(AccessConstants.LB_OUTPUT_BUFFER, teeResponse
+ .getOutputBuffer());
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw e;
+ } catch (ServletException e) {
+ e.printStackTrace();
+ throw e;
+ }
+ } else {
+ filterChain.doFilter(request, response);
+ }
+
+ }
+
+ public void init(FilterConfig arg0) throws ServletException {
+ // NOP
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java
index 414c0c329bbecccfdaae84da3c9ed2b75e7c59a2..0868045f805f85402ddc5562f5ab6dee351087ac 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletRequest.java
@@ -1,82 +1,82 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.servlet;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-
-import ch.qos.logback.access.AccessConstants;
-
-/**
- * As the "tee" program on Unix, duplicate the request's input stream.
- *
- * @author Ceki Gülcü
- */
-class TeeHttpServletRequest extends HttpServletRequestWrapper {
-
- private TeeServletInputStream inStream;
- private BufferedReader reader;
- boolean postedParametersMode = false;
-
- TeeHttpServletRequest(HttpServletRequest request) {
- super(request);
- if (Util.isFormUrlEncoded(request)) {
- postedParametersMode = true;
- } else {
- inStream = new TeeServletInputStream(request);
- // add the contents of the input buffer as an attribute of the request
- request
- .setAttribute(AccessConstants.LB_INPUT_BUFFER, inStream.getInputBuffer());
- reader = new BufferedReader(new InputStreamReader(inStream));
- }
-
- }
-
- byte[] getInputBuffer() {
- if (postedParametersMode) {
- throw new IllegalStateException("Call disallowed in postedParametersMode");
- }
- return inStream.getInputBuffer();
- }
-
- @Override
- public ServletInputStream getInputStream() throws IOException {
- if (!postedParametersMode) {
- return inStream;
- } else {
- return super.getInputStream();
- }
- }
-
- //
-
- @Override
- public BufferedReader getReader() throws IOException {
- if (!postedParametersMode) {
- return reader;
- } else {
- return super.getReader();
- }
- }
-
- public boolean isPostedParametersMode() {
- return postedParametersMode;
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.servlet;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+import ch.qos.logback.access.AccessConstants;
+
+/**
+ * As the "tee" program on Unix, duplicate the request's input stream.
+ *
+ * @author Ceki Gülcü
+ */
+class TeeHttpServletRequest extends HttpServletRequestWrapper {
+
+ private TeeServletInputStream inStream;
+ private BufferedReader reader;
+ boolean postedParametersMode = false;
+
+ TeeHttpServletRequest(HttpServletRequest request) {
+ super(request);
+ if (Util.isFormUrlEncoded(request)) {
+ postedParametersMode = true;
+ } else {
+ inStream = new TeeServletInputStream(request);
+ // add the contents of the input buffer as an attribute of the request
+ request
+ .setAttribute(AccessConstants.LB_INPUT_BUFFER, inStream.getInputBuffer());
+ reader = new BufferedReader(new InputStreamReader(inStream));
+ }
+
+ }
+
+ byte[] getInputBuffer() {
+ if (postedParametersMode) {
+ throw new IllegalStateException("Call disallowed in postedParametersMode");
+ }
+ return inStream.getInputBuffer();
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException {
+ if (!postedParametersMode) {
+ return inStream;
+ } else {
+ return super.getInputStream();
+ }
+ }
+
+ //
+
+ @Override
+ public BufferedReader getReader() throws IOException {
+ if (!postedParametersMode) {
+ return reader;
+ } else {
+ return super.getReader();
+ }
+ }
+
+ public boolean isPostedParametersMode() {
+ return postedParametersMode;
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletResponse.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletResponse.java
index ffe88bd6e1aa19278269e4a1bc5d1ff26a2c46e0..8ea99f03f2c45c158d606e80cf415a826b5b9e56 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletResponse.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeHttpServletResponse.java
@@ -1,75 +1,75 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.servlet;
-
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
-
-public class TeeHttpServletResponse extends HttpServletResponseWrapper {
-
- TeeServletOutputStream teeServletOutputStream;
- PrintWriter teeWriter;
-
- public TeeHttpServletResponse(HttpServletResponse httpServletResponse) {
- super(httpServletResponse);
- }
-
- @Override
- public ServletOutputStream getOutputStream() throws IOException {
- if (teeServletOutputStream == null) {
- teeServletOutputStream = new TeeServletOutputStream(this.getResponse());
- }
- return teeServletOutputStream;
- }
-
- @Override
- public PrintWriter getWriter() throws IOException {
- if (this.teeWriter == null) {
- this.teeWriter = new PrintWriter(new OutputStreamWriter(getOutputStream()),
- true);
- }
- return this.teeWriter;
- }
-
- @Override
- public void flushBuffer() {
- if (this.teeWriter != null) {
- this.teeWriter.flush();
- }
- }
-
- byte[] getOutputBuffer() {
- // teeServletOutputStream can be null if the getOutputStream method is never
- // called.
- if (teeServletOutputStream != null) {
- return teeServletOutputStream.getOutputStreamAsByteArray();
- } else {
- return null;
- }
- }
-
- void finish() throws IOException {
- if (this.teeWriter != null) {
- this.teeWriter.close();
- }
- if (this.teeServletOutputStream != null) {
- this.teeServletOutputStream.close();
- }
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.servlet;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+public class TeeHttpServletResponse extends HttpServletResponseWrapper {
+
+ TeeServletOutputStream teeServletOutputStream;
+ PrintWriter teeWriter;
+
+ public TeeHttpServletResponse(HttpServletResponse httpServletResponse) {
+ super(httpServletResponse);
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException {
+ if (teeServletOutputStream == null) {
+ teeServletOutputStream = new TeeServletOutputStream(this.getResponse());
+ }
+ return teeServletOutputStream;
+ }
+
+ @Override
+ public PrintWriter getWriter() throws IOException {
+ if (this.teeWriter == null) {
+ this.teeWriter = new PrintWriter(new OutputStreamWriter(getOutputStream()),
+ true);
+ }
+ return this.teeWriter;
+ }
+
+ @Override
+ public void flushBuffer() {
+ if (this.teeWriter != null) {
+ this.teeWriter.flush();
+ }
+ }
+
+ byte[] getOutputBuffer() {
+ // teeServletOutputStream can be null if the getOutputStream method is never
+ // called.
+ if (teeServletOutputStream != null) {
+ return teeServletOutputStream.getOutputStreamAsByteArray();
+ } else {
+ return null;
+ }
+ }
+
+ void finish() throws IOException {
+ if (this.teeWriter != null) {
+ this.teeWriter.close();
+ }
+ if (this.teeServletOutputStream != null) {
+ this.teeServletOutputStream.close();
+ }
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java
index ec586b72566c86438262eeffa0a194ca3f1ccfc6..25a9b623583bddeb4f6dde623f856bf49ee1c695 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletInputStream.java
@@ -1,59 +1,59 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.servlet;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.HttpServletRequest;
-
-class TeeServletInputStream extends ServletInputStream {
-
- InputStream in;
- byte[] inputBuffer;
-
- TeeServletInputStream(HttpServletRequest request) {
- duplicateInputStream(request);
- }
-
- @Override
- public int read() throws IOException {
- //System.out.println("zzzzzzzzzz TeeServletInputStream.read called");
- return in.read();
- }
-
- private void duplicateInputStream(HttpServletRequest request) {
- try {
- int len = request.getContentLength();
- ServletInputStream originalSIS = request.getInputStream();
- if (len < 0) {
- in = originalSIS;
- } else {
- inputBuffer = new byte[len];
- int n = originalSIS.read(inputBuffer, 0, len);
- assert n == len;
- this.in = new ByteArrayInputStream(inputBuffer);
- originalSIS.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- byte[] getInputBuffer() {
- return inputBuffer;
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.servlet;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+
+class TeeServletInputStream extends ServletInputStream {
+
+ InputStream in;
+ byte[] inputBuffer;
+
+ TeeServletInputStream(HttpServletRequest request) {
+ duplicateInputStream(request);
+ }
+
+ @Override
+ public int read() throws IOException {
+ //System.out.println("zzzzzzzzzz TeeServletInputStream.read called");
+ return in.read();
+ }
+
+ private void duplicateInputStream(HttpServletRequest request) {
+ try {
+ int len = request.getContentLength();
+ ServletInputStream originalSIS = request.getInputStream();
+ if (len < 0) {
+ in = originalSIS;
+ } else {
+ inputBuffer = new byte[len];
+ int n = originalSIS.read(inputBuffer, 0, len);
+ assert n == len;
+ this.in = new ByteArrayInputStream(inputBuffer);
+ originalSIS.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ byte[] getInputBuffer() {
+ return inputBuffer;
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletOutputStream.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletOutputStream.java
index a707592f887a107dc6fc1675a9c61fdc3c0ba066..6e8e5035aaa6bab83487aee355da0363fee2e2fc 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletOutputStream.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/TeeServletOutputStream.java
@@ -1,88 +1,88 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.servlet;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.ServletResponse;
-
-public class TeeServletOutputStream extends ServletOutputStream {
-
- final ServletOutputStream underlyingStream;
- final ByteArrayOutputStream baosCopy;
-
- TeeServletOutputStream(ServletResponse httpServletResponse)
- throws IOException {
- // System.out.println("TeeServletOutputStream.constructor() called");
- this.underlyingStream = httpServletResponse.getOutputStream();
- baosCopy = new ByteArrayOutputStream();
- }
-
- byte[] getOutputStreamAsByteArray() {
- return baosCopy.toByteArray();
- }
-
- @Override
- public void write(int val) throws IOException {
- if (underlyingStream != null) {
- underlyingStream.write(val);
- baosCopy.write(val);
- }
- }
-
- @Override
- public void write(byte[] byteArray) throws IOException {
- if (underlyingStream == null) {
- return;
- }
- // System.out.println("WRITE TeeServletOutputStream.write(byte[]) called");
- write(byteArray, 0, byteArray.length);
- }
-
- @Override
- public void write(byte byteArray[], int offset, int length)
- throws IOException {
- if (underlyingStream == null) {
- return;
- }
- // System.out.println("WRITE TeeServletOutputStream.write(byte[], int, int)
- // called");
- // System.out.println(new String(byteArray, offset, length));
- underlyingStream.write(byteArray, offset, length);
- baosCopy.write(byteArray, offset, length);
- }
-
- @Override
- public void close() throws IOException {
- // System.out.println("CLOSE TeeServletOutputStream.close() called");
-
- // If the servlet accessing the stream is using a writer instead of
- // an OutputStream, it will probably call os.close() before calling
- // writer.close. Thus, the underlying output stream will be called
- // before the data sent to the writer could be flushed.
- }
-
-
- @Override
- public void flush() throws IOException {
- if (underlyingStream == null) {
- return;
- }
- // System.out.println("FLUSH TeeServletOutputStream.flush() called");
- underlyingStream.flush();
- baosCopy.flush();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.servlet;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletResponse;
+
+public class TeeServletOutputStream extends ServletOutputStream {
+
+ final ServletOutputStream underlyingStream;
+ final ByteArrayOutputStream baosCopy;
+
+ TeeServletOutputStream(ServletResponse httpServletResponse)
+ throws IOException {
+ // System.out.println("TeeServletOutputStream.constructor() called");
+ this.underlyingStream = httpServletResponse.getOutputStream();
+ baosCopy = new ByteArrayOutputStream();
+ }
+
+ byte[] getOutputStreamAsByteArray() {
+ return baosCopy.toByteArray();
+ }
+
+ @Override
+ public void write(int val) throws IOException {
+ if (underlyingStream != null) {
+ underlyingStream.write(val);
+ baosCopy.write(val);
+ }
+ }
+
+ @Override
+ public void write(byte[] byteArray) throws IOException {
+ if (underlyingStream == null) {
+ return;
+ }
+ // System.out.println("WRITE TeeServletOutputStream.write(byte[]) called");
+ write(byteArray, 0, byteArray.length);
+ }
+
+ @Override
+ public void write(byte byteArray[], int offset, int length)
+ throws IOException {
+ if (underlyingStream == null) {
+ return;
+ }
+ // System.out.println("WRITE TeeServletOutputStream.write(byte[], int, int)
+ // called");
+ // System.out.println(new String(byteArray, offset, length));
+ underlyingStream.write(byteArray, offset, length);
+ baosCopy.write(byteArray, offset, length);
+ }
+
+ @Override
+ public void close() throws IOException {
+ // System.out.println("CLOSE TeeServletOutputStream.close() called");
+
+ // If the servlet accessing the stream is using a writer instead of
+ // an OutputStream, it will probably call os.close() before calling
+ // writer.close. Thus, the underlying output stream will be called
+ // before the data sent to the writer could be flushed.
+ }
+
+
+ @Override
+ public void flush() throws IOException {
+ if (underlyingStream == null) {
+ return;
+ }
+ // System.out.println("FLUSH TeeServletOutputStream.flush() called");
+ underlyingStream.flush();
+ baosCopy.flush();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java b/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java
index d04693a9eea758e3cf696c28bcc118c95583670e..bcdde15a722ffdacc6332a0797842a5b240b1a71 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/servlet/Util.java
@@ -1,42 +1,42 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.servlet;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import ch.qos.logback.access.AccessConstants;
-
-public class Util {
-
- public static boolean isFormUrlEncoded(HttpServletRequest request) {
- if ("POST".equals(request.getMethod())
- && AccessConstants.X_WWW_FORM_URLECODED.equals(request.getContentType())) {
- return true;
- } else {
- return false;
- }
- }
-
- public static boolean isImageResponse(HttpServletResponse response) {
-
- String responseType = response.getContentType();
-
- if (responseType != null && responseType.startsWith(AccessConstants.IMAGE_CONTENT_TYPE)) {
- return true;
- } else {
- return false;
- }
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.servlet;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import ch.qos.logback.access.AccessConstants;
+
+public class Util {
+
+ public static boolean isFormUrlEncoded(HttpServletRequest request) {
+ if ("POST".equals(request.getMethod())
+ && AccessConstants.X_WWW_FORM_URLECODED.equals(request.getContentType())) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static boolean isImageResponse(HttpServletResponse response) {
+
+ String responseType = response.getContentType();
+
+ if (responseType != null && responseType.startsWith(AccessConstants.IMAGE_CONTENT_TYPE)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/sift/AccessEventDiscriminator.java b/logback-access/src/main/java/ch/qos/logback/access/sift/AccessEventDiscriminator.java
index 6d3733bb10ef724e575c9e4c059fe8b7be1a2fdd..610847241874377e7c3ad9183297b70b40be3696 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/sift/AccessEventDiscriminator.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/sift/AccessEventDiscriminator.java
@@ -1,201 +1,201 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.sift;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.sift.Discriminator;
-import ch.qos.logback.core.spi.ContextAwareBase;
-
-/**
- *
- * AccessEventDiscriminator's job is to return the value of a designated field
- * in an {@link AccessEvent} instance.
- *
- *
The field is specified via the {@link FieldName} property.
- *
- * @author Ceki Gülcü
- *
- */
-public class AccessEventDiscriminator extends ContextAwareBase implements
- Discriminator {
-
- boolean started = false;
-
- /**
- * At present time the followed fields can be designated: COOKIE,
- * REQUEST_ATTRIBUTE, SESSION_ATTRIBUTE, REMOTE_ADDRESS,
- * LOCAL_PORT,REQUEST_URI
- *
- *
The first three fields require an additional key. For the
- * SESSION_ATTRIBUTE field, the additional key named "id" has special meaning
- * as it is mapped to the session id of the current http request.
- */
- public enum FieldName {
- COOKIE, REQUEST_ATTRIBUTE, SESSION_ATTRIBUTE, REMOTE_ADDRESS, LOCAL_PORT, REQUEST_URI
- }
-
- String defaultValue;
- String key;
- FieldName fieldName;
- String additionalKey;
-
- public String getDiscriminatingValue(AccessEvent acccessEvent) {
- String rawValue = getRawDiscriminatingValue(acccessEvent);
- if (rawValue == null || rawValue.length() == 0) {
- return defaultValue;
- } else {
- return rawValue;
- }
- }
-
- public String getRawDiscriminatingValue(AccessEvent acccessEvent) {
- switch (fieldName) {
- case COOKIE:
- // tested
- return acccessEvent.getCookie(additionalKey);
- case LOCAL_PORT:
- return String.valueOf(acccessEvent.getLocalPort());
- case REQUEST_ATTRIBUTE:
- // tested
- return getRequestAttribute(acccessEvent);
- case SESSION_ATTRIBUTE:
- return getSessionAttribute(acccessEvent);
- case REMOTE_ADDRESS:
- return acccessEvent.getRemoteAddr();
- case REQUEST_URI:
- // tested
- return getRequestURI(acccessEvent);
- default:
- return null;
- }
- }
-
- private String getRequestAttribute(AccessEvent acccessEvent) {
- String attr = acccessEvent.getAttribute(additionalKey);
- if (AccessEvent.NA.equals(attr)) {
- return null;
- } else {
- return attr;
- }
- }
-
- private String getRequestURI(AccessEvent acccessEvent) {
- String uri = acccessEvent.getRequestURI();
- if (uri != null && uri.length() >= 1 && uri.charAt(0) == '/') {
- return uri.substring(1);
- } else {
- return uri;
- }
- }
-
- private String getSessionAttribute(AccessEvent acccessEvent) {
- HttpServletRequest req = acccessEvent.getRequest();
- if (req != null) {
- HttpSession session = req.getSession(false);
- if (session != null) {
- if ("id".equalsIgnoreCase(additionalKey)) {
- return session.getId();
- } else {
- Object v = session.getAttribute(additionalKey);
- if (v != null) {
- return v.toString();
- }
- }
- }
- }
- return null;
- }
-
- public boolean isStarted() {
- return started;
- }
-
- public void start() {
-
- int errorCount = 0;
-
- if (defaultValue == null) {
- addError("\"DefaultValue\" property must be set.");
- }
- if (fieldName == null) {
- addError("\"FieldName\" property must be set.");
- errorCount++;
- }
-
- switch (fieldName) {
- case SESSION_ATTRIBUTE:
- case REQUEST_ATTRIBUTE:
- case COOKIE:
- if (additionalKey == null) {
- addError("\"OptionalKey\" property is mandatory for field name "
- + fieldName.toString());
- errorCount++;
- }
- }
-
- if (errorCount == 0) {
- started = true;
- }
- }
-
- public void stop() {
- started = false;
- }
-
- public void setFieldName(FieldName fieldName) {
- this.fieldName = fieldName;
- }
-
- public FieldName getFieldName() {
- return fieldName;
- }
-
- public String getAdditionalKey() {
- return additionalKey;
- }
-
- public void setAdditionalKey(String additionalKey) {
- this.additionalKey = additionalKey;
- }
-
- /**
- * @see #setDefaultValue(String)
- * @return
- */
- public String getDefaultValue() {
- return defaultValue;
- }
-
- /**
- * The default value returned by this discriminator in case it cannot compute
- * the discriminating value from the access event.
- *
- * @param defaultValue
- */
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.sift;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.sift.Discriminator;
+import ch.qos.logback.core.spi.ContextAwareBase;
+
+/**
+ *
+ * AccessEventDiscriminator's job is to return the value of a designated field
+ * in an {@link AccessEvent} instance.
+ *
+ *
The field is specified via the {@link FieldName} property.
+ *
+ * @author Ceki Gülcü
+ *
+ */
+public class AccessEventDiscriminator extends ContextAwareBase implements
+ Discriminator {
+
+ boolean started = false;
+
+ /**
+ * At present time the followed fields can be designated: COOKIE,
+ * REQUEST_ATTRIBUTE, SESSION_ATTRIBUTE, REMOTE_ADDRESS,
+ * LOCAL_PORT,REQUEST_URI
+ *
+ *
The first three fields require an additional key. For the
+ * SESSION_ATTRIBUTE field, the additional key named "id" has special meaning
+ * as it is mapped to the session id of the current http request.
+ */
+ public enum FieldName {
+ COOKIE, REQUEST_ATTRIBUTE, SESSION_ATTRIBUTE, REMOTE_ADDRESS, LOCAL_PORT, REQUEST_URI
+ }
+
+ String defaultValue;
+ String key;
+ FieldName fieldName;
+ String additionalKey;
+
+ public String getDiscriminatingValue(AccessEvent acccessEvent) {
+ String rawValue = getRawDiscriminatingValue(acccessEvent);
+ if (rawValue == null || rawValue.length() == 0) {
+ return defaultValue;
+ } else {
+ return rawValue;
+ }
+ }
+
+ public String getRawDiscriminatingValue(AccessEvent acccessEvent) {
+ switch (fieldName) {
+ case COOKIE:
+ // tested
+ return acccessEvent.getCookie(additionalKey);
+ case LOCAL_PORT:
+ return String.valueOf(acccessEvent.getLocalPort());
+ case REQUEST_ATTRIBUTE:
+ // tested
+ return getRequestAttribute(acccessEvent);
+ case SESSION_ATTRIBUTE:
+ return getSessionAttribute(acccessEvent);
+ case REMOTE_ADDRESS:
+ return acccessEvent.getRemoteAddr();
+ case REQUEST_URI:
+ // tested
+ return getRequestURI(acccessEvent);
+ default:
+ return null;
+ }
+ }
+
+ private String getRequestAttribute(AccessEvent acccessEvent) {
+ String attr = acccessEvent.getAttribute(additionalKey);
+ if (AccessEvent.NA.equals(attr)) {
+ return null;
+ } else {
+ return attr;
+ }
+ }
+
+ private String getRequestURI(AccessEvent acccessEvent) {
+ String uri = acccessEvent.getRequestURI();
+ if (uri != null && uri.length() >= 1 && uri.charAt(0) == '/') {
+ return uri.substring(1);
+ } else {
+ return uri;
+ }
+ }
+
+ private String getSessionAttribute(AccessEvent acccessEvent) {
+ HttpServletRequest req = acccessEvent.getRequest();
+ if (req != null) {
+ HttpSession session = req.getSession(false);
+ if (session != null) {
+ if ("id".equalsIgnoreCase(additionalKey)) {
+ return session.getId();
+ } else {
+ Object v = session.getAttribute(additionalKey);
+ if (v != null) {
+ return v.toString();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public void start() {
+
+ int errorCount = 0;
+
+ if (defaultValue == null) {
+ addError("\"DefaultValue\" property must be set.");
+ }
+ if (fieldName == null) {
+ addError("\"FieldName\" property must be set.");
+ errorCount++;
+ }
+
+ switch (fieldName) {
+ case SESSION_ATTRIBUTE:
+ case REQUEST_ATTRIBUTE:
+ case COOKIE:
+ if (additionalKey == null) {
+ addError("\"OptionalKey\" property is mandatory for field name "
+ + fieldName.toString());
+ errorCount++;
+ }
+ }
+
+ if (errorCount == 0) {
+ started = true;
+ }
+ }
+
+ public void stop() {
+ started = false;
+ }
+
+ public void setFieldName(FieldName fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ public FieldName getFieldName() {
+ return fieldName;
+ }
+
+ public String getAdditionalKey() {
+ return additionalKey;
+ }
+
+ public void setAdditionalKey(String additionalKey) {
+ this.additionalKey = additionalKey;
+ }
+
+ /**
+ * @see #setDefaultValue(String)
+ * @return
+ */
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * The default value returned by this discriminator in case it cannot compute
+ * the discriminating value from the access event.
+ *
+ * @param defaultValue
+ */
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/sift/AppenderFactory.java b/logback-access/src/main/java/ch/qos/logback/access/sift/AppenderFactory.java
index 3b264669b21e274e4476376a48ac5e2f58aaa9d1..62c2ff3fc70d13993117e98d39162e302a19c151 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/sift/AppenderFactory.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/sift/AppenderFactory.java
@@ -1,37 +1,37 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.sift;
-
-import java.util.List;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.joran.event.SaxEvent;
-import ch.qos.logback.core.sift.AppenderFactoryBase;
-import ch.qos.logback.core.sift.SiftingJoranConfiguratorBase;
-
-public class AppenderFactory extends AppenderFactoryBase {
-
- String keyName;
-
- AppenderFactory(List eventList, String keyName) {
- super(eventList);
- this.keyName = keyName;
- }
-
- public SiftingJoranConfiguratorBase getSiftingJoranConfigurator(
- String keyValue) {
- return new SiftingJoranConfigurator(keyName, keyValue);
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.sift;
+
+import java.util.List;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.joran.event.SaxEvent;
+import ch.qos.logback.core.sift.AppenderFactoryBase;
+import ch.qos.logback.core.sift.SiftingJoranConfiguratorBase;
+
+public class AppenderFactory extends AppenderFactoryBase {
+
+ String keyName;
+
+ AppenderFactory(List eventList, String keyName) {
+ super(eventList);
+ this.keyName = keyName;
+ }
+
+ public SiftingJoranConfiguratorBase getSiftingJoranConfigurator(
+ String keyValue) {
+ return new SiftingJoranConfigurator(keyName, keyValue);
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/sift/SiftAction.java b/logback-access/src/main/java/ch/qos/logback/access/sift/SiftAction.java
index 5f0dbd2ccd5a0049f123069f7ddab604f5836315..a5735ddc94712be20fd1a627da962dfc4c28afc8 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/sift/SiftAction.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/sift/SiftAction.java
@@ -1,59 +1,59 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.sift;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.xml.sax.Attributes;
-
-import ch.qos.logback.core.joran.action.Action;
-import ch.qos.logback.core.joran.event.InPlayListener;
-import ch.qos.logback.core.joran.event.SaxEvent;
-import ch.qos.logback.core.joran.spi.ActionException;
-import ch.qos.logback.core.joran.spi.InterpretationContext;
-
-public class SiftAction extends Action implements InPlayListener {
- List seList;
-
- @Override
- public void begin(InterpretationContext ec, String name, Attributes attributes)
- throws ActionException {
- seList = new ArrayList();
- ec.addInPlayListener(this);
- }
-
- @Override
- public void end(InterpretationContext ec, String name) throws ActionException {
- ec.removeInPlayListener(this);
- Object o = ec.peekObject();
- if (o instanceof SiftingAppender) {
- SiftingAppender siftingAppender = (SiftingAppender) o;
- AppenderFactory appenderFactory = new AppenderFactory(seList, siftingAppender.getDiscriminatorKey());
- siftingAppender.setAppenderFactory(appenderFactory);
- }
- }
-
- public void inPlay(SaxEvent event) {
- seList.add(event);
- }
-
- public List getSeList() {
- return seList;
- }
-
-
-
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.sift;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.xml.sax.Attributes;
+
+import ch.qos.logback.core.joran.action.Action;
+import ch.qos.logback.core.joran.event.InPlayListener;
+import ch.qos.logback.core.joran.event.SaxEvent;
+import ch.qos.logback.core.joran.spi.ActionException;
+import ch.qos.logback.core.joran.spi.InterpretationContext;
+
+public class SiftAction extends Action implements InPlayListener {
+ List seList;
+
+ @Override
+ public void begin(InterpretationContext ec, String name, Attributes attributes)
+ throws ActionException {
+ seList = new ArrayList();
+ ec.addInPlayListener(this);
+ }
+
+ @Override
+ public void end(InterpretationContext ec, String name) throws ActionException {
+ ec.removeInPlayListener(this);
+ Object o = ec.peekObject();
+ if (o instanceof SiftingAppender) {
+ SiftingAppender siftingAppender = (SiftingAppender) o;
+ AppenderFactory appenderFactory = new AppenderFactory(seList, siftingAppender.getDiscriminatorKey());
+ siftingAppender.setAppenderFactory(appenderFactory);
+ }
+ }
+
+ public void inPlay(SaxEvent event) {
+ seList.add(event);
+ }
+
+ public List getSeList() {
+ return seList;
+ }
+
+
+
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/sift/SiftingAppender.java b/logback-access/src/main/java/ch/qos/logback/access/sift/SiftingAppender.java
index 72d924d6300d84cd13273a4285039897b0299774..49b909ac3ee70aa4547e47ea1d2235380947e34f 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/sift/SiftingAppender.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/sift/SiftingAppender.java
@@ -1,53 +1,53 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.sift;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.joran.spi.DefaultClass;
-import ch.qos.logback.core.sift.AppenderTracker;
-import ch.qos.logback.core.sift.Discriminator;
-import ch.qos.logback.core.sift.SiftingAppenderBase;
-
-/**
- * This appender can contains other appenders which it can build dynamically
- * depending on MDC values. The built appender is specified as part of a
- * configuration file.
- *
- *
See the logback manual for further details.
- *
- *
- * @author Ceki Gulcu
- */
-public class SiftingAppender extends SiftingAppenderBase {
-
- @Override
- public void start() {
- super.start();
- }
-
- AppenderTracker getAppenderTracker() {
- return appenderTracker;
- }
-
- @Override
- protected long getTimestamp(AccessEvent event) {
- return event.getTimeStamp();
- }
-
- @Override
- @DefaultClass(AccessEventDiscriminator.class)
- public void setDiscriminator(Discriminator discriminator) {
- super.setDiscriminator(discriminator);
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.sift;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.joran.spi.DefaultClass;
+import ch.qos.logback.core.sift.AppenderTracker;
+import ch.qos.logback.core.sift.Discriminator;
+import ch.qos.logback.core.sift.SiftingAppenderBase;
+
+/**
+ * This appender can contains other appenders which it can build dynamically
+ * depending on MDC values. The built appender is specified as part of a
+ * configuration file.
+ *
+ *
See the logback manual for further details.
+ *
+ *
+ * @author Ceki Gulcu
+ */
+public class SiftingAppender extends SiftingAppenderBase {
+
+ @Override
+ public void start() {
+ super.start();
+ }
+
+ AppenderTracker getAppenderTracker() {
+ return appenderTracker;
+ }
+
+ @Override
+ protected long getTimestamp(AccessEvent event) {
+ return event.getTimeStamp();
+ }
+
+ @Override
+ @DefaultClass(AccessEventDiscriminator.class)
+ public void setDiscriminator(Discriminator discriminator) {
+ super.setDiscriminator(discriminator);
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/sift/SiftingJoranConfigurator.java b/logback-access/src/main/java/ch/qos/logback/access/sift/SiftingJoranConfigurator.java
index ae70acb12d69fe60fc8896cea15604d12648651d..0e0ca006843ab987b27f8adb7813fa50b1a6d15a 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/sift/SiftingJoranConfigurator.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/sift/SiftingJoranConfigurator.java
@@ -1,66 +1,66 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.sift;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.joran.action.ActionConst;
-import ch.qos.logback.core.joran.action.AppenderAction;
-import ch.qos.logback.core.joran.spi.Pattern;
-import ch.qos.logback.core.joran.spi.RuleStore;
-import ch.qos.logback.core.sift.SiftingJoranConfiguratorBase;
-
-public class SiftingJoranConfigurator extends SiftingJoranConfiguratorBase {
-
- String key;
- String value;
-
- SiftingJoranConfigurator(String key, String value) {
- this.key = key;
- this.value = value;
- }
-
- @Override
- protected Pattern initialPattern() {
- return new Pattern("configuration");
- }
-
- @Override
- protected void addInstanceRules(RuleStore rs) {
- rs.addRule(new Pattern("configuration/appender"), new AppenderAction());
- }
-
- @Override
- protected void buildInterpreter() {
- super.buildInterpreter();
- Map omap = interpreter.getInterpretationContext().getObjectMap();
- omap.put(ActionConst.APPENDER_BAG, new HashMap());
- omap.put(ActionConst.FILTER_CHAIN_BAG, new HashMap());
- Map propertiesMap = new HashMap();
- propertiesMap.put(key, value);
- interpreter.setInterpretationContextPropertiesMap(propertiesMap);
- }
-
- @SuppressWarnings("unchecked")
- public Appender getAppender() {
- Map omap = interpreter.getInterpretationContext().getObjectMap();
- HashMap map = (HashMap) omap.get(ActionConst.APPENDER_BAG);
- Collection values = map.values();
- return (Appender) values.iterator().next();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.sift;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.joran.action.ActionConst;
+import ch.qos.logback.core.joran.action.AppenderAction;
+import ch.qos.logback.core.joran.spi.Pattern;
+import ch.qos.logback.core.joran.spi.RuleStore;
+import ch.qos.logback.core.sift.SiftingJoranConfiguratorBase;
+
+public class SiftingJoranConfigurator extends SiftingJoranConfiguratorBase {
+
+ String key;
+ String value;
+
+ SiftingJoranConfigurator(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ protected Pattern initialPattern() {
+ return new Pattern("configuration");
+ }
+
+ @Override
+ protected void addInstanceRules(RuleStore rs) {
+ rs.addRule(new Pattern("configuration/appender"), new AppenderAction());
+ }
+
+ @Override
+ protected void buildInterpreter() {
+ super.buildInterpreter();
+ Map omap = interpreter.getInterpretationContext().getObjectMap();
+ omap.put(ActionConst.APPENDER_BAG, new HashMap());
+ omap.put(ActionConst.FILTER_CHAIN_BAG, new HashMap());
+ Map propertiesMap = new HashMap();
+ propertiesMap.put(key, value);
+ interpreter.setInterpretationContextPropertiesMap(propertiesMap);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Appender getAppender() {
+ Map omap = interpreter.getInterpretationContext().getObjectMap();
+ HashMap map = (HashMap) omap.get(ActionConst.APPENDER_BAG);
+ Collection values = map.values();
+ return (Appender) values.iterator().next();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/spi/AccessContext.java b/logback-access/src/main/java/ch/qos/logback/access/spi/AccessContext.java
index c8c6d0867172b23d8908cb92126e8f99e76471e0..2c55c6e5d4b1e9332706671b0cd14f4e1a8e2332 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/spi/AccessContext.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/spi/AccessContext.java
@@ -1,91 +1,91 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.spi;
-
-import java.util.Iterator;
-import java.util.List;
-
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.ContextBase;
-import ch.qos.logback.core.filter.Filter;
-import ch.qos.logback.core.spi.AppenderAttachable;
-import ch.qos.logback.core.spi.AppenderAttachableImpl;
-import ch.qos.logback.core.spi.FilterAttachable;
-import ch.qos.logback.core.spi.FilterAttachableImpl;
-import ch.qos.logback.core.spi.FilterReply;
-
-/**
- * A minimal context implementation used by certain logback-access components,
- * mainly SocketServer.
- *
- * @author Sébastien Pennec
- */
-public class AccessContext extends ContextBase implements
- AppenderAttachable, FilterAttachable {
-
- AppenderAttachableImpl aai = new AppenderAttachableImpl();
- FilterAttachableImpl fai = new FilterAttachableImpl();
-
- public void callAppenders(AccessEvent event) {
- aai.appendLoopOnAppenders(event);
- }
-
- public void addAppender(Appender newAppender) {
- aai.addAppender(newAppender);
- }
-
- public void detachAndStopAllAppenders() {
- aai.detachAndStopAllAppenders();
- }
-
- public boolean detachAppender(Appender appender) {
- return aai.detachAppender(appender);
- }
-
- public boolean detachAppender(String name) {
- return aai.detachAppender(name);
- }
-
- public Appender getAppender(String name) {
- return aai.getAppender(name);
- }
-
- public boolean isAttached(Appender appender) {
- return aai.isAttached(appender);
- }
-
- public Iterator> iteratorForAppenders() {
- return aai.iteratorForAppenders();
- }
-
- public void addFilter(Filter newFilter) {
- fai.addFilter(newFilter);
- }
-
- public void clearAllFilters() {
- fai.clearAllFilters();
- }
-
- public List> getCopyOfAttachedFiltersList() {
- return fai.getCopyOfAttachedFiltersList();
- }
-
- public FilterReply getFilterChainDecision(AccessEvent event) {
- return fai.getFilterChainDecision(event);
- }
-
- public Filter getFirstFilter() {
- return fai.getFirstFilter();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.spi;
+
+import java.util.Iterator;
+import java.util.List;
+
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.ContextBase;
+import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.spi.AppenderAttachable;
+import ch.qos.logback.core.spi.AppenderAttachableImpl;
+import ch.qos.logback.core.spi.FilterAttachable;
+import ch.qos.logback.core.spi.FilterAttachableImpl;
+import ch.qos.logback.core.spi.FilterReply;
+
+/**
+ * A minimal context implementation used by certain logback-access components,
+ * mainly SocketServer.
+ *
+ * @author Sébastien Pennec
+ */
+public class AccessContext extends ContextBase implements
+ AppenderAttachable, FilterAttachable {
+
+ AppenderAttachableImpl aai = new AppenderAttachableImpl();
+ FilterAttachableImpl fai = new FilterAttachableImpl();
+
+ public void callAppenders(AccessEvent event) {
+ aai.appendLoopOnAppenders(event);
+ }
+
+ public void addAppender(Appender newAppender) {
+ aai.addAppender(newAppender);
+ }
+
+ public void detachAndStopAllAppenders() {
+ aai.detachAndStopAllAppenders();
+ }
+
+ public boolean detachAppender(Appender appender) {
+ return aai.detachAppender(appender);
+ }
+
+ public boolean detachAppender(String name) {
+ return aai.detachAppender(name);
+ }
+
+ public Appender getAppender(String name) {
+ return aai.getAppender(name);
+ }
+
+ public boolean isAttached(Appender appender) {
+ return aai.isAttached(appender);
+ }
+
+ public Iterator> iteratorForAppenders() {
+ return aai.iteratorForAppenders();
+ }
+
+ public void addFilter(Filter newFilter) {
+ fai.addFilter(newFilter);
+ }
+
+ public void clearAllFilters() {
+ fai.clearAllFilters();
+ }
+
+ public List> getCopyOfAttachedFiltersList() {
+ return fai.getCopyOfAttachedFiltersList();
+ }
+
+ public FilterReply getFilterChainDecision(AccessEvent event) {
+ return fai.getFilterChainDecision(event);
+ }
+
+ public Filter getFirstFilter() {
+ return fai.getFirstFilter();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java b/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
index 9eec4efaa119e050198ea0e84a03d30f92bac607..3f50a604d234082ee948ffb8d39a35ba0463f181 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
@@ -1,493 +1,493 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.spi;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import ch.qos.logback.access.AccessConstants;
-import ch.qos.logback.access.pattern.AccessConverter;
-import ch.qos.logback.access.servlet.Util;
-
-// Contributors: Joern Huxhorn (see also bug #110)
-
-/**
- * The Access module's internal representation of logging events. When the
- * logging component instance is called in the container to log then a
- * AccessEvent instance is created. This instance is passed
- * around to the different logback components.
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public class AccessEvent implements Serializable {
-
-
- private static final long serialVersionUID = 866718993618836343L;
-
- public final static String NA = "-";
- public final static String[] NA_STRING_ARRAY = new String[] { AccessEvent.NA };
-
- public final static String EMPTY = "";
- public static final int SENTINEL = -1;
-
- private transient final HttpServletRequest httpRequest;
- private transient final HttpServletResponse httpResponse;
-
- String requestURI;
- String requestURL;
- String remoteHost;
- String remoteUser;
- String remoteAddr;
- String protocol;
- String method;
- String serverName;
- String requestContent;
- String responseContent;
-
- Map requestHeaderMap;
- Map requestParameterMap;
- Map responseHeaderMap;
-
- long contentLength = SENTINEL;
- int statusCode = SENTINEL;
- int localPort = SENTINEL;
-
- transient ServerAdapter serverAdapter;
-
- /**
- * The number of milliseconds elapsed from 1/1/1970 until logging event was
- * created.
- */
- private long timeStamp = 0;
-
- public AccessEvent(HttpServletRequest httpRequest,
- HttpServletResponse httpResponse, ServerAdapter adapter) {
- this.httpRequest = httpRequest;
- this.httpResponse = httpResponse;
- this.timeStamp = System.currentTimeMillis();
- this.serverAdapter = adapter;
- }
-
- /**
- * Returns the underlying HttpServletRequest. After serialization the returned
- * value will be null.
- *
- * @return
- */
- public HttpServletRequest getRequest() {
- return httpRequest;
- }
-
- /**
- * Returns the underlying HttpServletResponse. After serialization the returned
- * value will be null.
- *
- * @return
- */
- public HttpServletResponse getResponse() {
- return httpResponse;
- }
-
- public long getTimeStamp() {
- return timeStamp;
- }
-
- public void setTimeStamp(long timeStamp) {
- if (this.timeStamp != 0) {
- throw new IllegalStateException(
- "timeStamp has been already set for this event.");
- } else {
- this.timeStamp = timeStamp;
- }
- }
-
- public String getRequestURI() {
- if (requestURI == null) {
- if (httpRequest != null) {
- requestURI = httpRequest.getRequestURI();
- } else {
- requestURI = AccessEvent.NA;
- }
- }
- return requestURI;
- }
-
- /**
- * The first line of the request.
- */
- public String getRequestURL() {
- if (requestURL == null) {
- if (httpRequest != null) {
- StringBuffer buf = new StringBuffer();
- buf.append(httpRequest.getMethod());
- buf.append(AccessConverter.SPACE_CHAR);
- buf.append(httpRequest.getRequestURI());
- final String qStr = httpRequest.getQueryString();
- if (qStr != null) {
- buf.append(AccessConverter.QUESTION_CHAR);
- buf.append(qStr);
- }
- buf.append(AccessConverter.SPACE_CHAR);
- buf.append(httpRequest.getProtocol());
- requestURL = buf.toString();
- } else {
- requestURL = AccessEvent.NA;
- }
- }
- return requestURL;
- }
-
- public String getRemoteHost() {
- if (remoteHost == null) {
- if (httpRequest != null) {
- // the underlying implementation of HttpServletRequest will
- // determine if remote lookup will be performed
- remoteHost = httpRequest.getRemoteHost();
- } else {
- remoteHost = AccessEvent.NA;
- }
- }
- return remoteHost;
- }
-
- public String getRemoteUser() {
- if (remoteUser == null) {
- if (httpRequest != null) {
- remoteUser = httpRequest.getRemoteUser();
- } else {
- remoteUser = AccessEvent.NA;
- }
- }
- return remoteUser;
- }
-
- public String getProtocol() {
- if (protocol == null) {
- if (httpRequest != null) {
- protocol = httpRequest.getProtocol();
- } else {
- protocol = AccessEvent.NA;
- }
- }
- return protocol;
- }
-
- public String getMethod() {
- if (method == null) {
- if (httpRequest != null) {
- method = httpRequest.getMethod();
- } else {
- method = AccessEvent.NA;
- }
- }
- return method;
- }
-
- public String getServerName() {
- if (serverName == null) {
- if (httpRequest != null) {
- serverName = httpRequest.getServerName();
- } else {
- serverName = AccessEvent.NA;
- }
- }
- return serverName;
- }
-
- public String getRemoteAddr() {
- if (remoteAddr == null) {
- if (httpRequest != null) {
- remoteAddr = httpRequest.getRemoteAddr();
- } else {
- remoteAddr = AccessEvent.NA;
- }
- }
- return remoteAddr;
- }
-
- public String getRequestHeader(String key) {
- String result = null;
- if (requestHeaderMap == null) {
- if (httpRequest != null) {
- buildRequestHeaderMap();
- result = requestHeaderMap.get(key);
- }
- } else {
- result = requestHeaderMap.get(key);
- }
-
- if (result != null) {
- return result;
- } else {
- return AccessEvent.NA;
- }
- }
-
- public Enumeration getRequestHeaderNames() {
- // post-serialization
- if (httpRequest == null) {
- Vector list = new Vector(getRequestHeaderMap().keySet());
- return list.elements();
- }
- return httpRequest.getHeaderNames();
-
- }
-
- public Map getRequestHeaderMap() {
- if (requestHeaderMap == null) {
- buildRequestHeaderMap();
- }
- return requestHeaderMap;
- }
-
- public void buildRequestHeaderMap() {
- requestHeaderMap = new HashMap();
- Enumeration e = httpRequest.getHeaderNames();
- if (e == null) {
- return;
- }
- while (e.hasMoreElements()) {
- String key = (String) e.nextElement();
- requestHeaderMap.put(key, httpRequest.getHeader(key));
- }
- }
-
- public void buildRequestParameterMap() {
- requestParameterMap = new HashMap();
- Enumeration e = httpRequest.getParameterNames();
- if (e == null) {
- return;
- }
- while (e.hasMoreElements()) {
- String key = (String) e.nextElement();
- requestParameterMap.put(key, httpRequest.getParameterValues(key));
- }
- }
-
- public Map getRequestParameterMap() {
- if (requestParameterMap == null) {
- buildRequestParameterMap();
- }
- return requestParameterMap;
- }
-
- /**
- * Attributes are not serialized
- *
- * @param key
- */
- public String getAttribute(String key) {
- if (httpRequest != null) {
- Object value = httpRequest.getAttribute(key);
- if (value == null) {
- return AccessEvent.NA;
- } else {
- return value.toString();
- }
- } else {
- return AccessEvent.NA;
- }
- }
-
- public String[] getRequestParameter(String key) {
- if (httpRequest != null) {
- String[] value = httpRequest.getParameterValues(key);
- if (value == null) {
- return NA_STRING_ARRAY;
- } else {
- return value;
- }
- } else {
- return NA_STRING_ARRAY;
- }
- }
-
- public String getCookie(String key) {
-
- if (httpRequest != null) {
- Cookie[] cookieArray = httpRequest.getCookies();
- if (cookieArray == null) {
- return AccessEvent.NA;
- }
-
- for (Cookie cookie : cookieArray) {
- if (key.equals(cookie.getName())) {
- return cookie.getValue();
- }
- }
- }
- return AccessEvent.NA;
- }
-
- public long getContentLength() {
- if (contentLength == SENTINEL) {
- if (httpResponse != null) {
- contentLength = serverAdapter.getContentLength();
- return contentLength;
- }
- }
- return contentLength;
- }
-
- public int getStatusCode() {
- if (statusCode == SENTINEL) {
- if (httpResponse != null) {
- statusCode = serverAdapter.getStatusCode();
- }
- }
- return statusCode;
- }
-
- public String getRequestContent() {
- if (requestContent != null) {
- return requestContent;
- }
-
- if (Util.isFormUrlEncoded(httpRequest)) {
- StringBuffer buf = new StringBuffer();
-
- Enumeration pramEnumeration = httpRequest.getParameterNames();
-
- // example: id=1234&user=cgu
- // number=1233&x=1
- int count = 0;
- try {
- while (pramEnumeration.hasMoreElements()) {
-
- String key = (String) pramEnumeration.nextElement();
- if (count++ != 0) {
- buf.append("&");
- }
- buf.append(key);
- buf.append("=");
- String val = httpRequest.getParameter(key);
- if (val != null) {
- buf.append(val);
- } else {
- buf.append("");
- }
- }
- } catch (Exception e) {
- // FIXME Why is try/catch required?
- e.printStackTrace();
- }
- requestContent = buf.toString();
- } else {
-
- // retreive the byte array placed by TeeFilter
- byte[] inputBuffer = (byte[]) httpRequest
- .getAttribute(AccessConstants.LB_INPUT_BUFFER);
-
- if (inputBuffer != null) {
- requestContent = new String(inputBuffer);
- }
-
- if (requestContent == null || requestContent.length() == 0) {
- requestContent = EMPTY;
- }
- }
-
- return requestContent;
- }
-
- public String getResponseContent() {
- if (responseContent != null) {
- return responseContent;
- }
-
- if (Util.isImageResponse(httpResponse)) {
- responseContent = "[IMAGE CONTENTS SUPPRESSED]";
- } else {
-
- // retreive the byte array previously placed by TeeFilter
- byte[] outputBuffer = (byte[]) httpRequest
- .getAttribute(AccessConstants.LB_OUTPUT_BUFFER);
-
- if (outputBuffer != null) {
- responseContent = new String(outputBuffer);
- }
- if (responseContent == null || responseContent.length() == 0) {
- responseContent = EMPTY;
- }
- }
-
- return responseContent;
- }
-
- public int getLocalPort() {
- if (localPort == SENTINEL) {
- if (httpRequest != null) {
- localPort = httpRequest.getLocalPort();
- }
-
- }
- return localPort;
- }
-
- public ServerAdapter getServerAdapter() {
- return serverAdapter;
- }
-
- public String getResponseHeader(String key) {
- buildResponseHeaderMap();
- return responseHeaderMap.get(key);
- }
-
- void buildResponseHeaderMap() {
- if (responseHeaderMap == null) {
- responseHeaderMap = serverAdapter.buildResponseHeaderMap();
- }
- }
-
- public Map getResponseHeaderMap() {
- buildResponseHeaderMap();
- return responseHeaderMap;
- }
-
- public List getResponseHeaderNameList() {
- buildResponseHeaderMap();
- return new ArrayList(responseHeaderMap.keySet());
- }
-
- public void prepareForDeferredProcessing() {
- buildRequestHeaderMap();
- buildRequestParameterMap();
- buildResponseHeaderMap();
- getLocalPort();
- getMethod();
- getProtocol();
- getRemoteAddr();
- getRemoteHost();
- getRemoteUser();
- getRequestURI();
- getRequestURL();
- getServerName();
- getTimeStamp();
-
- getStatusCode();
- getContentLength();
- getRequestContent();
- getResponseContent();
- }
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.spi;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import ch.qos.logback.access.AccessConstants;
+import ch.qos.logback.access.pattern.AccessConverter;
+import ch.qos.logback.access.servlet.Util;
+
+// Contributors: Joern Huxhorn (see also bug #110)
+
+/**
+ * The Access module's internal representation of logging events. When the
+ * logging component instance is called in the container to log then a
+ * AccessEvent instance is created. This instance is passed
+ * around to the different logback components.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public class AccessEvent implements Serializable {
+
+
+ private static final long serialVersionUID = 866718993618836343L;
+
+ public final static String NA = "-";
+ public final static String[] NA_STRING_ARRAY = new String[] { AccessEvent.NA };
+
+ public final static String EMPTY = "";
+ public static final int SENTINEL = -1;
+
+ private transient final HttpServletRequest httpRequest;
+ private transient final HttpServletResponse httpResponse;
+
+ String requestURI;
+ String requestURL;
+ String remoteHost;
+ String remoteUser;
+ String remoteAddr;
+ String protocol;
+ String method;
+ String serverName;
+ String requestContent;
+ String responseContent;
+
+ Map requestHeaderMap;
+ Map requestParameterMap;
+ Map responseHeaderMap;
+
+ long contentLength = SENTINEL;
+ int statusCode = SENTINEL;
+ int localPort = SENTINEL;
+
+ transient ServerAdapter serverAdapter;
+
+ /**
+ * The number of milliseconds elapsed from 1/1/1970 until logging event was
+ * created.
+ */
+ private long timeStamp = 0;
+
+ public AccessEvent(HttpServletRequest httpRequest,
+ HttpServletResponse httpResponse, ServerAdapter adapter) {
+ this.httpRequest = httpRequest;
+ this.httpResponse = httpResponse;
+ this.timeStamp = System.currentTimeMillis();
+ this.serverAdapter = adapter;
+ }
+
+ /**
+ * Returns the underlying HttpServletRequest. After serialization the returned
+ * value will be null.
+ *
+ * @return
+ */
+ public HttpServletRequest getRequest() {
+ return httpRequest;
+ }
+
+ /**
+ * Returns the underlying HttpServletResponse. After serialization the returned
+ * value will be null.
+ *
+ * @return
+ */
+ public HttpServletResponse getResponse() {
+ return httpResponse;
+ }
+
+ public long getTimeStamp() {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(long timeStamp) {
+ if (this.timeStamp != 0) {
+ throw new IllegalStateException(
+ "timeStamp has been already set for this event.");
+ } else {
+ this.timeStamp = timeStamp;
+ }
+ }
+
+ public String getRequestURI() {
+ if (requestURI == null) {
+ if (httpRequest != null) {
+ requestURI = httpRequest.getRequestURI();
+ } else {
+ requestURI = AccessEvent.NA;
+ }
+ }
+ return requestURI;
+ }
+
+ /**
+ * The first line of the request.
+ */
+ public String getRequestURL() {
+ if (requestURL == null) {
+ if (httpRequest != null) {
+ StringBuffer buf = new StringBuffer();
+ buf.append(httpRequest.getMethod());
+ buf.append(AccessConverter.SPACE_CHAR);
+ buf.append(httpRequest.getRequestURI());
+ final String qStr = httpRequest.getQueryString();
+ if (qStr != null) {
+ buf.append(AccessConverter.QUESTION_CHAR);
+ buf.append(qStr);
+ }
+ buf.append(AccessConverter.SPACE_CHAR);
+ buf.append(httpRequest.getProtocol());
+ requestURL = buf.toString();
+ } else {
+ requestURL = AccessEvent.NA;
+ }
+ }
+ return requestURL;
+ }
+
+ public String getRemoteHost() {
+ if (remoteHost == null) {
+ if (httpRequest != null) {
+ // the underlying implementation of HttpServletRequest will
+ // determine if remote lookup will be performed
+ remoteHost = httpRequest.getRemoteHost();
+ } else {
+ remoteHost = AccessEvent.NA;
+ }
+ }
+ return remoteHost;
+ }
+
+ public String getRemoteUser() {
+ if (remoteUser == null) {
+ if (httpRequest != null) {
+ remoteUser = httpRequest.getRemoteUser();
+ } else {
+ remoteUser = AccessEvent.NA;
+ }
+ }
+ return remoteUser;
+ }
+
+ public String getProtocol() {
+ if (protocol == null) {
+ if (httpRequest != null) {
+ protocol = httpRequest.getProtocol();
+ } else {
+ protocol = AccessEvent.NA;
+ }
+ }
+ return protocol;
+ }
+
+ public String getMethod() {
+ if (method == null) {
+ if (httpRequest != null) {
+ method = httpRequest.getMethod();
+ } else {
+ method = AccessEvent.NA;
+ }
+ }
+ return method;
+ }
+
+ public String getServerName() {
+ if (serverName == null) {
+ if (httpRequest != null) {
+ serverName = httpRequest.getServerName();
+ } else {
+ serverName = AccessEvent.NA;
+ }
+ }
+ return serverName;
+ }
+
+ public String getRemoteAddr() {
+ if (remoteAddr == null) {
+ if (httpRequest != null) {
+ remoteAddr = httpRequest.getRemoteAddr();
+ } else {
+ remoteAddr = AccessEvent.NA;
+ }
+ }
+ return remoteAddr;
+ }
+
+ public String getRequestHeader(String key) {
+ String result = null;
+ if (requestHeaderMap == null) {
+ if (httpRequest != null) {
+ buildRequestHeaderMap();
+ result = requestHeaderMap.get(key);
+ }
+ } else {
+ result = requestHeaderMap.get(key);
+ }
+
+ if (result != null) {
+ return result;
+ } else {
+ return AccessEvent.NA;
+ }
+ }
+
+ public Enumeration getRequestHeaderNames() {
+ // post-serialization
+ if (httpRequest == null) {
+ Vector list = new Vector(getRequestHeaderMap().keySet());
+ return list.elements();
+ }
+ return httpRequest.getHeaderNames();
+
+ }
+
+ public Map getRequestHeaderMap() {
+ if (requestHeaderMap == null) {
+ buildRequestHeaderMap();
+ }
+ return requestHeaderMap;
+ }
+
+ public void buildRequestHeaderMap() {
+ requestHeaderMap = new HashMap();
+ Enumeration e = httpRequest.getHeaderNames();
+ if (e == null) {
+ return;
+ }
+ while (e.hasMoreElements()) {
+ String key = (String) e.nextElement();
+ requestHeaderMap.put(key, httpRequest.getHeader(key));
+ }
+ }
+
+ public void buildRequestParameterMap() {
+ requestParameterMap = new HashMap();
+ Enumeration e = httpRequest.getParameterNames();
+ if (e == null) {
+ return;
+ }
+ while (e.hasMoreElements()) {
+ String key = (String) e.nextElement();
+ requestParameterMap.put(key, httpRequest.getParameterValues(key));
+ }
+ }
+
+ public Map getRequestParameterMap() {
+ if (requestParameterMap == null) {
+ buildRequestParameterMap();
+ }
+ return requestParameterMap;
+ }
+
+ /**
+ * Attributes are not serialized
+ *
+ * @param key
+ */
+ public String getAttribute(String key) {
+ if (httpRequest != null) {
+ Object value = httpRequest.getAttribute(key);
+ if (value == null) {
+ return AccessEvent.NA;
+ } else {
+ return value.toString();
+ }
+ } else {
+ return AccessEvent.NA;
+ }
+ }
+
+ public String[] getRequestParameter(String key) {
+ if (httpRequest != null) {
+ String[] value = httpRequest.getParameterValues(key);
+ if (value == null) {
+ return NA_STRING_ARRAY;
+ } else {
+ return value;
+ }
+ } else {
+ return NA_STRING_ARRAY;
+ }
+ }
+
+ public String getCookie(String key) {
+
+ if (httpRequest != null) {
+ Cookie[] cookieArray = httpRequest.getCookies();
+ if (cookieArray == null) {
+ return AccessEvent.NA;
+ }
+
+ for (Cookie cookie : cookieArray) {
+ if (key.equals(cookie.getName())) {
+ return cookie.getValue();
+ }
+ }
+ }
+ return AccessEvent.NA;
+ }
+
+ public long getContentLength() {
+ if (contentLength == SENTINEL) {
+ if (httpResponse != null) {
+ contentLength = serverAdapter.getContentLength();
+ return contentLength;
+ }
+ }
+ return contentLength;
+ }
+
+ public int getStatusCode() {
+ if (statusCode == SENTINEL) {
+ if (httpResponse != null) {
+ statusCode = serverAdapter.getStatusCode();
+ }
+ }
+ return statusCode;
+ }
+
+ public String getRequestContent() {
+ if (requestContent != null) {
+ return requestContent;
+ }
+
+ if (Util.isFormUrlEncoded(httpRequest)) {
+ StringBuffer buf = new StringBuffer();
+
+ Enumeration pramEnumeration = httpRequest.getParameterNames();
+
+ // example: id=1234&user=cgu
+ // number=1233&x=1
+ int count = 0;
+ try {
+ while (pramEnumeration.hasMoreElements()) {
+
+ String key = (String) pramEnumeration.nextElement();
+ if (count++ != 0) {
+ buf.append("&");
+ }
+ buf.append(key);
+ buf.append("=");
+ String val = httpRequest.getParameter(key);
+ if (val != null) {
+ buf.append(val);
+ } else {
+ buf.append("");
+ }
+ }
+ } catch (Exception e) {
+ // FIXME Why is try/catch required?
+ e.printStackTrace();
+ }
+ requestContent = buf.toString();
+ } else {
+
+ // retreive the byte array placed by TeeFilter
+ byte[] inputBuffer = (byte[]) httpRequest
+ .getAttribute(AccessConstants.LB_INPUT_BUFFER);
+
+ if (inputBuffer != null) {
+ requestContent = new String(inputBuffer);
+ }
+
+ if (requestContent == null || requestContent.length() == 0) {
+ requestContent = EMPTY;
+ }
+ }
+
+ return requestContent;
+ }
+
+ public String getResponseContent() {
+ if (responseContent != null) {
+ return responseContent;
+ }
+
+ if (Util.isImageResponse(httpResponse)) {
+ responseContent = "[IMAGE CONTENTS SUPPRESSED]";
+ } else {
+
+ // retreive the byte array previously placed by TeeFilter
+ byte[] outputBuffer = (byte[]) httpRequest
+ .getAttribute(AccessConstants.LB_OUTPUT_BUFFER);
+
+ if (outputBuffer != null) {
+ responseContent = new String(outputBuffer);
+ }
+ if (responseContent == null || responseContent.length() == 0) {
+ responseContent = EMPTY;
+ }
+ }
+
+ return responseContent;
+ }
+
+ public int getLocalPort() {
+ if (localPort == SENTINEL) {
+ if (httpRequest != null) {
+ localPort = httpRequest.getLocalPort();
+ }
+
+ }
+ return localPort;
+ }
+
+ public ServerAdapter getServerAdapter() {
+ return serverAdapter;
+ }
+
+ public String getResponseHeader(String key) {
+ buildResponseHeaderMap();
+ return responseHeaderMap.get(key);
+ }
+
+ void buildResponseHeaderMap() {
+ if (responseHeaderMap == null) {
+ responseHeaderMap = serverAdapter.buildResponseHeaderMap();
+ }
+ }
+
+ public Map getResponseHeaderMap() {
+ buildResponseHeaderMap();
+ return responseHeaderMap;
+ }
+
+ public List getResponseHeaderNameList() {
+ buildResponseHeaderMap();
+ return new ArrayList(responseHeaderMap.keySet());
+ }
+
+ public void prepareForDeferredProcessing() {
+ buildRequestHeaderMap();
+ buildRequestParameterMap();
+ buildResponseHeaderMap();
+ getLocalPort();
+ getMethod();
+ getProtocol();
+ getRemoteAddr();
+ getRemoteHost();
+ getRemoteUser();
+ getRequestURI();
+ getRequestURL();
+ getServerName();
+ getTimeStamp();
+
+ getStatusCode();
+ getContentLength();
+ getRequestContent();
+ getResponseContent();
+ }
}
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java b/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java
index a5563f68bb45ada9b4407afb80a66541fd4c89fb..191147413bfd8f198188462cf74e67d779e49a2e 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java
@@ -1,34 +1,34 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.spi;
-
-import java.util.Map;
-
-/**
- * An interface to access server-specific methods from
- * the server-independent AccessEvent.
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public interface ServerAdapter {
-
- long getContentLength();
- int getStatusCode();
-// String getResponseHeader(String key);
-// List getResponseHeaderNameList();
-// Map getResponseHeaderMap();
-
- Map buildResponseHeaderMap();
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.spi;
+
+import java.util.Map;
+
+/**
+ * An interface to access server-specific methods from
+ * the server-independent AccessEvent.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public interface ServerAdapter {
+
+ long getContentLength();
+ int getStatusCode();
+// String getResponseHeader(String key);
+// List getResponseHeaderNameList();
+// Map getResponseHeaderMap();
+
+ Map buildResponseHeaderMap();
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/spi/Util.java b/logback-access/src/main/java/ch/qos/logback/access/spi/Util.java
index e86d1896356f20c4bc9118dc421bfaa988c13066..12ae682ca11ad77869865d221cd342024ab5b44d 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/spi/Util.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/spi/Util.java
@@ -1,35 +1,35 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.spi;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class Util {
- static final int BUF_SIZE= 128;
-
- public static String readToString(InputStream in) throws IOException {
- if(in == null) {
- return null;
- }
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buf = new byte[BUF_SIZE];
- int n = 0;
- while( (n = in.read(buf, 0, BUF_SIZE)) != -1) {
- baos.write(buf, 0, n);
- }
- return baos.toString();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.spi;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class Util {
+ static final int BUF_SIZE= 128;
+
+ public static String readToString(InputStream in) throws IOException {
+ if(in == null) {
+ return null;
+ }
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] buf = new byte[BUF_SIZE];
+ int n = 0;
+ while( (n = in.read(buf, 0, BUF_SIZE)) != -1) {
+ baos.write(buf, 0, n);
+ }
+ return baos.toString();
+ }
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/spi/package.html b/logback-access/src/main/java/ch/qos/logback/access/spi/package.html
index ae7fcc8f1cd2bd18068e0e907ba48125d9b27503..08b45592c11c95236c8dc4c389e63f83268be205 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/spi/package.html
+++ b/logback-access/src/main/java/ch/qos/logback/access/spi/package.html
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
Contains the core classes of logback access.
-
-
+
+
+
+
+
+
+
+
+
+
Contains the core classes of logback access.
+
+
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java b/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java
index 95347d25e49d5970bf261301686f849200d67c7f..4c39e271d5c2793fac0af6596b6d074d5170c632 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/tomcat/LogbackValve.java
@@ -1,291 +1,291 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.tomcat;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-import org.apache.catalina.Lifecycle;
-import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-import org.apache.catalina.valves.ValveBase;
-
-import ch.qos.logback.access.AccessConstants;
-import ch.qos.logback.access.joran.JoranConfigurator;
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.BasicStatusManager;
-import ch.qos.logback.core.Context;
-import ch.qos.logback.core.CoreConstants;
-import ch.qos.logback.core.filter.Filter;
-import ch.qos.logback.core.joran.spi.JoranException;
-import ch.qos.logback.core.spi.AppenderAttachable;
-import ch.qos.logback.core.spi.AppenderAttachableImpl;
-import ch.qos.logback.core.spi.FilterAttachable;
-import ch.qos.logback.core.spi.FilterAttachableImpl;
-import ch.qos.logback.core.spi.FilterReply;
-import ch.qos.logback.core.status.InfoStatus;
-import ch.qos.logback.core.status.StatusManager;
-import ch.qos.logback.core.status.WarnStatus;
-import ch.qos.logback.core.util.OptionHelper;
-import ch.qos.logback.core.util.StatusPrinter;
-
-/**
- * This class is an implementation of tomcat's Valve interface, by extending
- * ValveBase.
- *
- *
For more information on using LogbackValve please refer to the online
- * documentation on logback-acces and tomcat.
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public class LogbackValve extends ValveBase implements Lifecycle, Context,
- AppenderAttachable, FilterAttachable {
-
- public final static String DEFAULT_CONFIG_FILE = "conf" + File.separatorChar
- + "logback-access.xml";
-
- private long birthTime = System.currentTimeMillis();
- Object configurationLock = new Object();
-
-
- // Attributes from ContextBase:
- private String name;
- StatusManager sm = new BasicStatusManager();
- // TODO propertyMap should be observable so that we can be notified
- // when it changes so that a new instance of propertyMap can be
- // serialized. For the time being, we ignore this shortcoming.
- Map propertyMap = new HashMap();
- Map objectMap = new HashMap();
- private FilterAttachableImpl fai = new FilterAttachableImpl();
-
- AppenderAttachableImpl aai = new AppenderAttachableImpl();
- String filename;
- boolean quiet;
- boolean started;
- boolean alreadySetLogbackStatusManager = false;
-
- public LogbackValve() {
- putObject(CoreConstants.EVALUATOR_MAP, new HashMap());
- }
-
- public void start() {
- if (filename == null) {
- String tomcatHomeProperty = OptionHelper
- .getSystemProperty("catalina.home");
-
- filename = tomcatHomeProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
- getStatusManager().add(
- new InfoStatus("filename property not set. Assuming [" + filename
- + "]", this));
- }
- File configFile = new File(filename);
- if (configFile.exists()) {
- try {
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(this);
- jc.doConfigure(filename);
- } catch (JoranException e) {
- // TODO can we do better than printing a stack trace on syserr?
- e.printStackTrace();
- }
- } else {
- getStatusManager().add(
- new WarnStatus("[" + filename + "] does not exist", this));
- }
-
- if (!quiet) {
- StatusPrinter.print(getStatusManager());
- }
-
- started = true;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public boolean isQuiet() {
- return quiet;
- }
-
- public void setQuiet(boolean quiet) {
- this.quiet = quiet;
- }
-
- public void invoke(Request request, Response response) throws IOException,
- ServletException {
-
- try {
-
- if (!alreadySetLogbackStatusManager) {
- alreadySetLogbackStatusManager = true;
- org.apache.catalina.Context tomcatContext = request.getContext();
- if (tomcatContext != null) {
- ServletContext sc = tomcatContext.getServletContext();
- if (sc != null) {
- sc.setAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY,
- getStatusManager());
- }
- }
- }
-
- getNext().invoke(request, response);
-
- TomcatServerAdapter adapter = new TomcatServerAdapter(request, response);
- AccessEvent accessEvent = new AccessEvent(request, response, adapter);
-
- if (getFilterChainDecision(accessEvent) == FilterReply.DENY) {
- return;
- }
-
- // TODO better exception handling
- aai.appendLoopOnAppenders(accessEvent);
- } finally {
- request
- .removeAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY);
- }
- }
-
- public void stop() {
- started = false;
- }
-
- public void addAppender(Appender newAppender) {
- aai.addAppender(newAppender);
- }
-
- public Iterator> iteratorForAppenders() {
- return aai.iteratorForAppenders();
- }
-
- public Appender getAppender(String name) {
- return aai.getAppender(name);
- }
-
- public boolean isAttached(Appender appender) {
- return aai.isAttached(appender);
- }
-
- public void detachAndStopAllAppenders() {
- aai.detachAndStopAllAppenders();
-
- }
-
- public boolean detachAppender(Appender appender) {
- return aai.detachAppender(appender);
- }
-
- public boolean detachAppender(String name) {
- return aai.detachAppender(name);
- }
-
- public String getInfo() {
- return "Logback's implementation of ValveBase";
- }
-
- // Methods from ContextBase:
- public StatusManager getStatusManager() {
- return sm;
- }
-
- public Map getPropertyMap() {
- return propertyMap;
- }
-
- public void putProperty(String key, String val) {
- this.propertyMap.put(key, val);
- }
-
- public String getProperty(String key) {
- return (String) this.propertyMap.get(key);
- }
-
- public Object getObject(String key) {
- return objectMap.get(key);
- }
-
- public void putObject(String key, Object value) {
- objectMap.put(key, value);
- }
-
- public void addFilter(Filter newFilter) {
- fai.addFilter(newFilter);
- }
-
- public Filter getFirstFilter() {
- return fai.getFirstFilter();
- }
-
- public void clearAllFilters() {
- fai.clearAllFilters();
- }
-
- public List> getCopyOfAttachedFiltersList() {
- return fai.getCopyOfAttachedFiltersList();
- }
-
- public FilterReply getFilterChainDecision(AccessEvent event) {
- return fai.getFilterChainDecision(event);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- if (this.name != null) {
- throw new IllegalStateException(
- "LogbackValve has been already given a name");
- }
- this.name = name;
- }
-
- public long getBithTime() {
- return birthTime;
- }
-
- public Object getConfigurationLock() {
- return configurationLock;
- }
-
- // ====== Methods from catalina Lifecycle =====
-
- public void addLifecycleListener(LifecycleListener arg0) {
- // dummy NOP implementation
- }
-
- public LifecycleListener[] findLifecycleListeners() {
- return new LifecycleListener[0];
- }
-
- public void removeLifecycleListener(LifecycleListener arg0) {
- // dummy NOP implementation
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.tomcat;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.valves.ValveBase;
+
+import ch.qos.logback.access.AccessConstants;
+import ch.qos.logback.access.joran.JoranConfigurator;
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.BasicStatusManager;
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.CoreConstants;
+import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.joran.spi.JoranException;
+import ch.qos.logback.core.spi.AppenderAttachable;
+import ch.qos.logback.core.spi.AppenderAttachableImpl;
+import ch.qos.logback.core.spi.FilterAttachable;
+import ch.qos.logback.core.spi.FilterAttachableImpl;
+import ch.qos.logback.core.spi.FilterReply;
+import ch.qos.logback.core.status.InfoStatus;
+import ch.qos.logback.core.status.StatusManager;
+import ch.qos.logback.core.status.WarnStatus;
+import ch.qos.logback.core.util.OptionHelper;
+import ch.qos.logback.core.util.StatusPrinter;
+
+/**
+ * This class is an implementation of tomcat's Valve interface, by extending
+ * ValveBase.
+ *
+ *
For more information on using LogbackValve please refer to the online
+ * documentation on logback-acces and tomcat.
+ *
+ * @author Ceki Gülcü
+ * @author Sébastien Pennec
+ */
+public class LogbackValve extends ValveBase implements Lifecycle, Context,
+ AppenderAttachable, FilterAttachable {
+
+ public final static String DEFAULT_CONFIG_FILE = "conf" + File.separatorChar
+ + "logback-access.xml";
+
+ private long birthTime = System.currentTimeMillis();
+ Object configurationLock = new Object();
+
+
+ // Attributes from ContextBase:
+ private String name;
+ StatusManager sm = new BasicStatusManager();
+ // TODO propertyMap should be observable so that we can be notified
+ // when it changes so that a new instance of propertyMap can be
+ // serialized. For the time being, we ignore this shortcoming.
+ Map propertyMap = new HashMap();
+ Map objectMap = new HashMap();
+ private FilterAttachableImpl fai = new FilterAttachableImpl();
+
+ AppenderAttachableImpl aai = new AppenderAttachableImpl();
+ String filename;
+ boolean quiet;
+ boolean started;
+ boolean alreadySetLogbackStatusManager = false;
+
+ public LogbackValve() {
+ putObject(CoreConstants.EVALUATOR_MAP, new HashMap());
+ }
+
+ public void start() {
+ if (filename == null) {
+ String tomcatHomeProperty = OptionHelper
+ .getSystemProperty("catalina.home");
+
+ filename = tomcatHomeProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
+ getStatusManager().add(
+ new InfoStatus("filename property not set. Assuming [" + filename
+ + "]", this));
+ }
+ File configFile = new File(filename);
+ if (configFile.exists()) {
+ try {
+ JoranConfigurator jc = new JoranConfigurator();
+ jc.setContext(this);
+ jc.doConfigure(filename);
+ } catch (JoranException e) {
+ // TODO can we do better than printing a stack trace on syserr?
+ e.printStackTrace();
+ }
+ } else {
+ getStatusManager().add(
+ new WarnStatus("[" + filename + "] does not exist", this));
+ }
+
+ if (!quiet) {
+ StatusPrinter.print(getStatusManager());
+ }
+
+ started = true;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public boolean isQuiet() {
+ return quiet;
+ }
+
+ public void setQuiet(boolean quiet) {
+ this.quiet = quiet;
+ }
+
+ public void invoke(Request request, Response response) throws IOException,
+ ServletException {
+
+ try {
+
+ if (!alreadySetLogbackStatusManager) {
+ alreadySetLogbackStatusManager = true;
+ org.apache.catalina.Context tomcatContext = request.getContext();
+ if (tomcatContext != null) {
+ ServletContext sc = tomcatContext.getServletContext();
+ if (sc != null) {
+ sc.setAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY,
+ getStatusManager());
+ }
+ }
+ }
+
+ getNext().invoke(request, response);
+
+ TomcatServerAdapter adapter = new TomcatServerAdapter(request, response);
+ AccessEvent accessEvent = new AccessEvent(request, response, adapter);
+
+ if (getFilterChainDecision(accessEvent) == FilterReply.DENY) {
+ return;
+ }
+
+ // TODO better exception handling
+ aai.appendLoopOnAppenders(accessEvent);
+ } finally {
+ request
+ .removeAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY);
+ }
+ }
+
+ public void stop() {
+ started = false;
+ }
+
+ public void addAppender(Appender newAppender) {
+ aai.addAppender(newAppender);
+ }
+
+ public Iterator> iteratorForAppenders() {
+ return aai.iteratorForAppenders();
+ }
+
+ public Appender getAppender(String name) {
+ return aai.getAppender(name);
+ }
+
+ public boolean isAttached(Appender appender) {
+ return aai.isAttached(appender);
+ }
+
+ public void detachAndStopAllAppenders() {
+ aai.detachAndStopAllAppenders();
+
+ }
+
+ public boolean detachAppender(Appender appender) {
+ return aai.detachAppender(appender);
+ }
+
+ public boolean detachAppender(String name) {
+ return aai.detachAppender(name);
+ }
+
+ public String getInfo() {
+ return "Logback's implementation of ValveBase";
+ }
+
+ // Methods from ContextBase:
+ public StatusManager getStatusManager() {
+ return sm;
+ }
+
+ public Map getPropertyMap() {
+ return propertyMap;
+ }
+
+ public void putProperty(String key, String val) {
+ this.propertyMap.put(key, val);
+ }
+
+ public String getProperty(String key) {
+ return (String) this.propertyMap.get(key);
+ }
+
+ public Object getObject(String key) {
+ return objectMap.get(key);
+ }
+
+ public void putObject(String key, Object value) {
+ objectMap.put(key, value);
+ }
+
+ public void addFilter(Filter newFilter) {
+ fai.addFilter(newFilter);
+ }
+
+ public Filter getFirstFilter() {
+ return fai.getFirstFilter();
+ }
+
+ public void clearAllFilters() {
+ fai.clearAllFilters();
+ }
+
+ public List> getCopyOfAttachedFiltersList() {
+ return fai.getCopyOfAttachedFiltersList();
+ }
+
+ public FilterReply getFilterChainDecision(AccessEvent event) {
+ return fai.getFilterChainDecision(event);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ if (this.name != null) {
+ throw new IllegalStateException(
+ "LogbackValve has been already given a name");
+ }
+ this.name = name;
+ }
+
+ public long getBithTime() {
+ return birthTime;
+ }
+
+ public Object getConfigurationLock() {
+ return configurationLock;
+ }
+
+ // ====== Methods from catalina Lifecycle =====
+
+ public void addLifecycleListener(LifecycleListener arg0) {
+ // dummy NOP implementation
+ }
+
+ public LifecycleListener[] findLifecycleListeners() {
+ return new LifecycleListener[0];
+ }
+
+ public void removeLifecycleListener(LifecycleListener arg0) {
+ // dummy NOP implementation
+ }
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java b/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java
index 0ee05a12fad15b95efe4b502b5145d97cd7ae8d2..5fab333219e0a76064af929111e15b8850b695c7 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java
@@ -1,59 +1,59 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.tomcat;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-
-import ch.qos.logback.access.spi.ServerAdapter;
-
-/**
- * A tomcat specific implementation of the {@link ServerAdapter} interface.
- *
- * @author Sébastien Pennec
- */
-public class TomcatServerAdapter implements ServerAdapter {
-
- Request request;
- Response response;
-
- public TomcatServerAdapter(Request tomcatRequest, Response tomcatResponse) {
- this.request = tomcatRequest;
- this.response = tomcatResponse;
- }
-
- public long getContentLength() {
- return response.getContentLength();
- }
-
- public int getStatusCode() {
- return response.getStatus();
- }
-
-
- public Map buildResponseHeaderMap() {
- Map responseHeaderMap = new HashMap();
- for (String key : response.getHeaderNames()) {
- String value = response.getHeader(key);
- responseHeaderMap.put(key, value);
- }
- return responseHeaderMap;
- }
-
-
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.tomcat;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+import ch.qos.logback.access.spi.ServerAdapter;
+
+/**
+ * A tomcat specific implementation of the {@link ServerAdapter} interface.
+ *
+ * @author Sébastien Pennec
+ */
+public class TomcatServerAdapter implements ServerAdapter {
+
+ Request request;
+ Response response;
+
+ public TomcatServerAdapter(Request tomcatRequest, Response tomcatResponse) {
+ this.request = tomcatRequest;
+ this.response = tomcatResponse;
+ }
+
+ public long getContentLength() {
+ return response.getContentLength();
+ }
+
+ public int getStatusCode() {
+ return response.getStatus();
+ }
+
+
+ public Map buildResponseHeaderMap() {
+ Map responseHeaderMap = new HashMap();
+ for (String key : response.getHeaderNames()) {
+ String value = response.getHeader(key);
+ responseHeaderMap.put(key, value);
+ }
+ return responseHeaderMap;
+ }
+
+
+
+}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/tomcat/package.html b/logback-access/src/main/java/ch/qos/logback/access/tomcat/package.html
index b716f7947d74b24516602124bd3a3ac21fe40366..c96b85259ff4295358615b4d03075072ba8fc9bd 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/tomcat/package.html
+++ b/logback-access/src/main/java/ch/qos/logback/access/tomcat/package.html
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
This is logback access' implementation for Tomcat.
-
-
+
+
+
+
+
+
+
+
+
+
This is logback access' implementation for Tomcat.
+
+
\ No newline at end of file
diff --git a/logback-access/src/test/input/integration/db/mysql-with-driver.xml b/logback-access/src/test/input/integration/db/mysql-with-driver.xml
index 0e35e712c028f6c536bbe8f81ada637f5b01daac..81bfdd89b1c4912ca537c45512d6f63eb1f36374 100644
--- a/logback-access/src/test/input/integration/db/mysql-with-driver.xml
+++ b/logback-access/src/test/input/integration/db/mysql-with-driver.xml
@@ -1,17 +1,17 @@
-
-
-
-
-
-
- com.mysql.jdbc.Driver
- jdbc:mysql://localhost:3306/logback
- root
-
-
-
-
-
-
-
+
+
+
+
+
+
+ com.mysql.jdbc.Driver
+ jdbc:mysql://localhost:3306/logback
+ root
+
+
+
+
+
+
+
diff --git a/logback-access/src/test/input/integration/db/oracle10g-with-driver.xml b/logback-access/src/test/input/integration/db/oracle10g-with-driver.xml
index 52a578ef07f83ce101f619eac73931b73a840bc8..bf7dc67b4d27b7e3a881993cfd1c9b5d58debc66 100644
--- a/logback-access/src/test/input/integration/db/oracle10g-with-driver.xml
+++ b/logback-access/src/test/input/integration/db/oracle10g-with-driver.xml
@@ -1,17 +1,17 @@
-
-
-
-
-
-
- oracle.jdbc.OracleDriver
- jdbc:oracle:thin:@localhost:1522:xe
- hr
- hr
-
-
-
-
-
-
+
+
+
+
+
+
+ oracle.jdbc.OracleDriver
+ jdbc:oracle:thin:@localhost:1522:xe
+ hr
+ hr
+
+
+
+
+
+
diff --git a/logback-access/src/test/input/integration/db/oracle11g-with-driver.xml b/logback-access/src/test/input/integration/db/oracle11g-with-driver.xml
index 393189fb53f96a9915bab69c787f58a5ea05b725..8ed022d986d73a280dabd97c96348f21ce0ce4d1 100644
--- a/logback-access/src/test/input/integration/db/oracle11g-with-driver.xml
+++ b/logback-access/src/test/input/integration/db/oracle11g-with-driver.xml
@@ -1,17 +1,17 @@
-
-
-
-
-
-
- oracle.jdbc.OracleDriver
- jdbc:oracle:thin:@localhost:1521:orcl
- SCOTT
- SCOTT
-
-
-
-
-
-
-
+
+
+
+
+
+
+ oracle.jdbc.OracleDriver
+ jdbc:oracle:thin:@localhost:1521:orcl
+ SCOTT
+ SCOTT
+
+
+
+
+
+
+
diff --git a/logback-access/src/test/input/integration/db/postgresql-with-driver.xml b/logback-access/src/test/input/integration/db/postgresql-with-driver.xml
index fc8dbb63953a05c2655836c52fc363d8d3965f27..8b047abbca00afdacf24d1b879a3c9cd4c38c6a1 100644
--- a/logback-access/src/test/input/integration/db/postgresql-with-driver.xml
+++ b/logback-access/src/test/input/integration/db/postgresql-with-driver.xml
@@ -1,16 +1,16 @@
-
-
-
-
-
-
- org.postgresql.Driver
- jdbc:postgresql://192.168.1.5:5432/test
- logback
- logback
-
-
-
-
-
-
+
+
+
+
+
+
+ org.postgresql.Driver
+ jdbc:postgresql://192.168.1.5:5432/test
+ logback
+ logback
+
+
+
+
+
+
diff --git a/logback-access/src/test/input/integration/db/sqlserver-with-driver.xml b/logback-access/src/test/input/integration/db/sqlserver-with-driver.xml
index 1c49a86e6f84c11ff515ba548bf0f40e056bfc70..85c0ee20b561d1a5be14f0733588a5c7de9dda4e 100644
--- a/logback-access/src/test/input/integration/db/sqlserver-with-driver.xml
+++ b/logback-access/src/test/input/integration/db/sqlserver-with-driver.xml
@@ -1,16 +1,16 @@
-
-
-
-
-
-
- com.microsoft.sqlserver.jdbc.SQLServerDriver
- jdbc:sqlserver://localhost:1987;databaseName=logback;
- logback
- logback
-
-
-
-
-
-
+
+
+
+
+
+
+ com.microsoft.sqlserver.jdbc.SQLServerDriver
+ jdbc:sqlserver://localhost:1987;databaseName=logback;
+ logback
+ logback
+
+
+
+
+
+
diff --git a/logback-access/src/test/input/jetty/sifting.xml b/logback-access/src/test/input/jetty/sifting.xml
index 10dfada9e31555b7a2e1b36f43b8468f2972e1c1..b4b89b63dd86687c45a24b3ce8d04b327a564742 100644
--- a/logback-access/src/test/input/jetty/sifting.xml
+++ b/logback-access/src/test/input/jetty/sifting.xml
@@ -1,17 +1,17 @@
-
-
-
-
-
- uri
- REQUEST_URI
- NA
-
-
-
-
-
-
-
+
+
+
+
+
+ uri
+ REQUEST_URI
+ NA
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/logback-access/src/test/input/joran/defaultLayout.xml b/logback-access/src/test/input/joran/defaultLayout.xml
index 95050e1042c98f0926ad9b8637d28ed8475fe64d..d486bf7856f29a54ea5e47ba252ddc3f4b2183db 100644
--- a/logback-access/src/test/input/joran/defaultLayout.xml
+++ b/logback-access/src/test/input/joran/defaultLayout.xml
@@ -1,13 +1,13 @@
-
-
-
-
-
- %requestMethod
-
-
-
-
+
+
+
+
+
+ %requestMethod
+
+
+
+
\ No newline at end of file
diff --git a/logback-access/src/test/input/joran/smoke.xml b/logback-access/src/test/input/joran/smoke.xml
index 69b7375425dc73814a86eeb856007f43c97d6163..a62cdcedbfdac5722833560a64a05144c2729332 100644
--- a/logback-access/src/test/input/joran/smoke.xml
+++ b/logback-access/src/test/input/joran/smoke.xml
@@ -1,5 +1,5 @@
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/logback-access/src/test/java/ch/qos/logback/access/AllAccessTest.java b/logback-access/src/test/java/ch/qos/logback/access/AllAccessTest.java
index dda44b45bfe80778829cadc8e492957e3954cbe8..255c095da42d8c35967647fa2b2b2e2c4391c512 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/AllAccessTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/AllAccessTest.java
@@ -1,29 +1,29 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses( { ch.qos.logback.access.spi.PackageTest.class,
- ch.qos.logback.access.net.PackageTest.class,
- ch.qos.logback.access.pattern.PackageTest.class,
- ch.qos.logback.access.jetty.PackageTest.class,
- ch.qos.logback.access.filter.PackageTest.class,
- ch.qos.logback.access.sift.PackageTest.class })
-public class AllAccessTest {
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses( { ch.qos.logback.access.spi.PackageTest.class,
+ ch.qos.logback.access.net.PackageTest.class,
+ ch.qos.logback.access.pattern.PackageTest.class,
+ ch.qos.logback.access.jetty.PackageTest.class,
+ ch.qos.logback.access.filter.PackageTest.class,
+ ch.qos.logback.access.sift.PackageTest.class })
+public class AllAccessTest {
+
+}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/TeztConstants.java b/logback-access/src/test/java/ch/qos/logback/access/TeztConstants.java
index fcd1eb88b668d337f769be6453aa27ee84c9d4f2..d3cd4103497d20c6cd6753c7b2dd6e79808e616f 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/TeztConstants.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/TeztConstants.java
@@ -1,19 +1,19 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access;
-
-public class TeztConstants {
-
- public static final String TEST_DIR_PREFIX = "src/test/";
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access;
+
+public class TeztConstants {
+
+ public static final String TEST_DIR_PREFIX = "src/test/";
+}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderIntegrationTest.java b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderIntegrationTest.java
index 3874835817ada6a8ced1862e601901891309b41e..6c9b56ede28d7268d42d5a7941d33cd62add5d14 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderIntegrationTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderIntegrationTest.java
@@ -1,143 +1,143 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.db;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.InetAddress;
-import java.util.Random;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import ch.qos.logback.access.dummy.DummyAccessEventBuilder;
-import ch.qos.logback.access.joran.JoranConfigurator;
-import ch.qos.logback.access.spi.AccessContext;
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.joran.spi.JoranException;
-import ch.qos.logback.core.status.Status;
-import ch.qos.logback.core.testUtil.Env;
-import ch.qos.logback.core.util.StatusPrinter;
-
-public class DBAppenderIntegrationTest {
-
- static String LOCAL_HOST_NAME;
- static String[] CONFORMING_HOST_LIST = new String[] { "Orion" };
-
- int diff = new Random(System.nanoTime()).nextInt(10000);
- AccessContext context = new AccessContext();
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- InetAddress localhostIA = InetAddress.getLocalHost();
- LOCAL_HOST_NAME = localhostIA.getHostName();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- public void doTest(String configFile) throws JoranException {
- JoranConfigurator configurator = new JoranConfigurator();
- configurator.setContext(context);
- configurator.doConfigure(configFile);
-
- Appender appender = context.getAppender("DB");
-
- for (int i = 0; i < 10; i++) {
- AccessEvent event = DummyAccessEventBuilder.buildNewAccessEvent();
- appender.doAppend(event);
- }
-
- StatusPrinter.print(context);
-
- // check that there were no errors
- assertEquals(Status.INFO, context.getStatusManager().getLevel());
-
- }
-
- static boolean isConformingHostAndJDK16OrHigher() {
- if(!Env.isJDK6OrHigher()) {
- return false;
- }
- for (String conformingHost : CONFORMING_HOST_LIST) {
- if (conformingHost.equalsIgnoreCase(LOCAL_HOST_NAME)) {
- return true;
- }
- }
- return false;
- }
-
- @Test
- public void sqlserver() throws Exception {
- // perform test only on conforming hosts
- if (!isConformingHostAndJDK16OrHigher()) {
- return;
- }
- doTest("src/test/input/integration/db/sqlserver-with-driver.xml");
- }
-
- @Test
- @Ignore
- public void oracle10g() throws Exception {
- // perform test only on conforming hosts
- if (!isConformingHostAndJDK16OrHigher()) {
- return;
- }
- doTest("src/test/input/integration/db/oracle10g-with-driver.xml");
- }
-
- @Test
- @Ignore
- public void oracle11g() throws Exception {
- // perform test only on conforming hosts
- if (!isConformingHostAndJDK16OrHigher()) {
- return;
- }
- doTest("src/test/input/integration/db/oracle11g-with-driver.xml");
- }
-
- @Test
- public void mysql() throws Exception {
- // perform test only on conforming hosts
- if (!isConformingHostAndJDK16OrHigher()) {
- return;
- }
- doTest("src/test/input/integration/db/mysql-with-driver.xml");
- }
-
- @Test
- public void postgres() throws Exception {
- // perform test only on conforming hosts
- if (!isConformingHostAndJDK16OrHigher()) {
- return;
- }
- doTest("src/test/input/integration/db/postgresql-with-driver.xml");
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.db;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.InetAddress;
+import java.util.Random;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import ch.qos.logback.access.dummy.DummyAccessEventBuilder;
+import ch.qos.logback.access.joran.JoranConfigurator;
+import ch.qos.logback.access.spi.AccessContext;
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.joran.spi.JoranException;
+import ch.qos.logback.core.status.Status;
+import ch.qos.logback.core.testUtil.Env;
+import ch.qos.logback.core.util.StatusPrinter;
+
+public class DBAppenderIntegrationTest {
+
+ static String LOCAL_HOST_NAME;
+ static String[] CONFORMING_HOST_LIST = new String[] { "Orion" };
+
+ int diff = new Random(System.nanoTime()).nextInt(10000);
+ AccessContext context = new AccessContext();
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ InetAddress localhostIA = InetAddress.getLocalHost();
+ LOCAL_HOST_NAME = localhostIA.getHostName();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ public void doTest(String configFile) throws JoranException {
+ JoranConfigurator configurator = new JoranConfigurator();
+ configurator.setContext(context);
+ configurator.doConfigure(configFile);
+
+ Appender appender = context.getAppender("DB");
+
+ for (int i = 0; i < 10; i++) {
+ AccessEvent event = DummyAccessEventBuilder.buildNewAccessEvent();
+ appender.doAppend(event);
+ }
+
+ StatusPrinter.print(context);
+
+ // check that there were no errors
+ assertEquals(Status.INFO, context.getStatusManager().getLevel());
+
+ }
+
+ static boolean isConformingHostAndJDK16OrHigher() {
+ if(!Env.isJDK6OrHigher()) {
+ return false;
+ }
+ for (String conformingHost : CONFORMING_HOST_LIST) {
+ if (conformingHost.equalsIgnoreCase(LOCAL_HOST_NAME)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Test
+ public void sqlserver() throws Exception {
+ // perform test only on conforming hosts
+ if (!isConformingHostAndJDK16OrHigher()) {
+ return;
+ }
+ doTest("src/test/input/integration/db/sqlserver-with-driver.xml");
+ }
+
+ @Test
+ @Ignore
+ public void oracle10g() throws Exception {
+ // perform test only on conforming hosts
+ if (!isConformingHostAndJDK16OrHigher()) {
+ return;
+ }
+ doTest("src/test/input/integration/db/oracle10g-with-driver.xml");
+ }
+
+ @Test
+ @Ignore
+ public void oracle11g() throws Exception {
+ // perform test only on conforming hosts
+ if (!isConformingHostAndJDK16OrHigher()) {
+ return;
+ }
+ doTest("src/test/input/integration/db/oracle11g-with-driver.xml");
+ }
+
+ @Test
+ public void mysql() throws Exception {
+ // perform test only on conforming hosts
+ if (!isConformingHostAndJDK16OrHigher()) {
+ return;
+ }
+ doTest("src/test/input/integration/db/mysql-with-driver.xml");
+ }
+
+ @Test
+ public void postgres() throws Exception {
+ // perform test only on conforming hosts
+ if (!isConformingHostAndJDK16OrHigher()) {
+ return;
+ }
+ doTest("src/test/input/integration/db/postgresql-with-driver.xml");
+ }
+
+}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTest.java b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTest.java
index 62f658ca2db36849e39fc5b5ce83c44327412a68..88c5aa2c0947d93d9261ac5e7e5d83d1d8a731a8 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTest.java
@@ -1,204 +1,204 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.db;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import ch.qos.logback.access.dummy.DummyRequest;
-import ch.qos.logback.access.dummy.DummyResponse;
-import ch.qos.logback.access.dummy.DummyServerAdapter;
-import ch.qos.logback.access.spi.AccessContext;
-import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.core.db.DriverManagerConnectionSource;
-import ch.qos.logback.core.util.StatusPrinter;
-
-public class DBAppenderTest {
-
- AccessContext context;
- DBAppender appender;
- DriverManagerConnectionSource connectionSource;
-
- static DBAppenderTestFixture DB_APPENDER_TEST_FIXTURE;
-
- @BeforeClass
- static public void fixtureSetUp() throws SQLException {
- DB_APPENDER_TEST_FIXTURE = new DBAppenderTestFixture();
- DB_APPENDER_TEST_FIXTURE.setUp();
- }
-
- @AfterClass
- static public void fixtureTearDown() throws SQLException {
- DB_APPENDER_TEST_FIXTURE.tearDown();
- }
-
- @Before
- public void setUp() throws SQLException {
- context = new AccessContext();
- context.setName("default");
- appender = new DBAppender();
- appender.setName("DB");
- appender.setContext(context);
- connectionSource = new DriverManagerConnectionSource();
- connectionSource.setContext(context);
- connectionSource.setDriverClass(DBAppenderTestFixture.DRIVER_CLASS);
- connectionSource.setUrl(DB_APPENDER_TEST_FIXTURE.url);
- connectionSource.setUser(DB_APPENDER_TEST_FIXTURE.user);
- connectionSource.setPassword(DB_APPENDER_TEST_FIXTURE.password);
- connectionSource.start();
- appender.setConnectionSource(connectionSource);
- }
-
- private void setInsertHeadersAndStart(boolean insert) {
- appender.setInsertHeaders(insert);
- appender.start();
- }
-
- @After
- public void tearDown() throws SQLException {
- context = null;
- appender = null;
- connectionSource = null;
- }
-
- @Test
- public void testAppendAccessEvent() throws SQLException {
- setInsertHeadersAndStart(false);
-
- AccessEvent event = createAccessEvent();
- appender.append(event);
-
- Statement stmt = connectionSource.getConnection().createStatement();
- ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM access_event");
- if (rs.next()) {
- assertEquals(event.getTimeStamp(), rs.getLong(1));
- assertEquals(event.getRequestURI(), rs.getString(2));
- assertEquals(event.getRequestURL(), rs.getString(3));
- assertEquals(event.getRemoteHost(), rs.getString(4));
- assertEquals(event.getRemoteUser(), rs.getString(5));
- assertEquals(event.getRemoteAddr(), rs.getString(6));
- assertEquals(event.getProtocol(), rs.getString(7));
- assertEquals(event.getMethod(), rs.getString(8));
- assertEquals(event.getServerName(), rs.getString(9));
- assertEquals(event.getRequestContent(), rs.getString(10));
- } else {
- fail("No row was inserted in the database");
- }
-
- rs.close();
- stmt.close();
- }
-
-
- @Test
- public void testCheckNoHeadersAreInserted() throws Exception {
- setInsertHeadersAndStart(false);
-
- AccessEvent event = createAccessEvent();
- appender.append(event);
- StatusPrinter.print(context.getStatusManager());
-
- //Check that no headers were inserted
- Statement stmt = connectionSource.getConnection().createStatement();
- ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM access_event_header");
-
- assertFalse(rs.next());
- rs.close();
- stmt.close();
- }
-
- @Test
- public void testAppendHeaders() throws SQLException {
- setInsertHeadersAndStart(true);
-
- AccessEvent event = createAccessEvent();
- appender.append(event);
-
- Statement stmt = connectionSource.getConnection().createStatement();
- ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM access_event_header");
- String key;
- String value;
- if (!rs.next()) {
- fail("There should be results to this query");
- } else {
- key = rs.getString(2);
- value = rs.getString(3);
- assertNotNull(key);
- assertNotNull(value);
- assertEquals(event.getRequestHeader(key), value);
- rs.next();
- key = rs.getString(2);
- value = rs.getString(3);
- assertNotNull(key);
- assertNotNull(value);
- assertEquals(event.getRequestHeader(key), value);
- }
- if (rs.next()) {
- fail("There should be no more rows available");
- }
-
- rs.close();
- stmt.close();
- }
-
- @Test
- public void testAppendMultipleEvents() throws SQLException {
- String uri = "testAppendMultipleEvents";
- for (int i = 0; i < 10; i++) {
- AccessEvent event = createAccessEvent(uri);
- appender.append(event);
- }
-
- Statement stmt = connectionSource.getConnection().createStatement();
- ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM access_event where requestURI='"+uri+"'");
- int count = 0;
- while (rs.next()) {
- count++;
- }
- assertEquals(10, count);
-
- rs.close();
- stmt.close();
- }
-
- private AccessEvent createAccessEvent() {
- return createAccessEvent("");
- }
-
- private AccessEvent createAccessEvent(String uri) {
- DummyRequest request = new DummyRequest();
- request.setRequestUri(uri);
- DummyResponse response = new DummyResponse();
- DummyServerAdapter adapter = new DummyServerAdapter(request, response);
-
- AccessEvent ae = new AccessEvent(request, response, adapter);
- return ae;
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.db;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import ch.qos.logback.access.dummy.DummyRequest;
+import ch.qos.logback.access.dummy.DummyResponse;
+import ch.qos.logback.access.dummy.DummyServerAdapter;
+import ch.qos.logback.access.spi.AccessContext;
+import ch.qos.logback.access.spi.AccessEvent;
+import ch.qos.logback.core.db.DriverManagerConnectionSource;
+import ch.qos.logback.core.util.StatusPrinter;
+
+public class DBAppenderTest {
+
+ AccessContext context;
+ DBAppender appender;
+ DriverManagerConnectionSource connectionSource;
+
+ static DBAppenderTestFixture DB_APPENDER_TEST_FIXTURE;
+
+ @BeforeClass
+ static public void fixtureSetUp() throws SQLException {
+ DB_APPENDER_TEST_FIXTURE = new DBAppenderTestFixture();
+ DB_APPENDER_TEST_FIXTURE.setUp();
+ }
+
+ @AfterClass
+ static public void fixtureTearDown() throws SQLException {
+ DB_APPENDER_TEST_FIXTURE.tearDown();
+ }
+
+ @Before
+ public void setUp() throws SQLException {
+ context = new AccessContext();
+ context.setName("default");
+ appender = new DBAppender();
+ appender.setName("DB");
+ appender.setContext(context);
+ connectionSource = new DriverManagerConnectionSource();
+ connectionSource.setContext(context);
+ connectionSource.setDriverClass(DBAppenderTestFixture.DRIVER_CLASS);
+ connectionSource.setUrl(DB_APPENDER_TEST_FIXTURE.url);
+ connectionSource.setUser(DB_APPENDER_TEST_FIXTURE.user);
+ connectionSource.setPassword(DB_APPENDER_TEST_FIXTURE.password);
+ connectionSource.start();
+ appender.setConnectionSource(connectionSource);
+ }
+
+ private void setInsertHeadersAndStart(boolean insert) {
+ appender.setInsertHeaders(insert);
+ appender.start();
+ }
+
+ @After
+ public void tearDown() throws SQLException {
+ context = null;
+ appender = null;
+ connectionSource = null;
+ }
+
+ @Test
+ public void testAppendAccessEvent() throws SQLException {
+ setInsertHeadersAndStart(false);
+
+ AccessEvent event = createAccessEvent();
+ appender.append(event);
+
+ Statement stmt = connectionSource.getConnection().createStatement();
+ ResultSet rs = null;
+ rs = stmt.executeQuery("SELECT * FROM access_event");
+ if (rs.next()) {
+ assertEquals(event.getTimeStamp(), rs.getLong(1));
+ assertEquals(event.getRequestURI(), rs.getString(2));
+ assertEquals(event.getRequestURL(), rs.getString(3));
+ assertEquals(event.getRemoteHost(), rs.getString(4));
+ assertEquals(event.getRemoteUser(), rs.getString(5));
+ assertEquals(event.getRemoteAddr(), rs.getString(6));
+ assertEquals(event.getProtocol(), rs.getString(7));
+ assertEquals(event.getMethod(), rs.getString(8));
+ assertEquals(event.getServerName(), rs.getString(9));
+ assertEquals(event.getRequestContent(), rs.getString(10));
+ } else {
+ fail("No row was inserted in the database");
+ }
+
+ rs.close();
+ stmt.close();
+ }
+
+
+ @Test
+ public void testCheckNoHeadersAreInserted() throws Exception {
+ setInsertHeadersAndStart(false);
+
+ AccessEvent event = createAccessEvent();
+ appender.append(event);
+ StatusPrinter.print(context.getStatusManager());
+
+ //Check that no headers were inserted
+ Statement stmt = connectionSource.getConnection().createStatement();
+ ResultSet rs = null;
+ rs = stmt.executeQuery("SELECT * FROM access_event_header");
+
+ assertFalse(rs.next());
+ rs.close();
+ stmt.close();
+ }
+
+ @Test
+ public void testAppendHeaders() throws SQLException {
+ setInsertHeadersAndStart(true);
+
+ AccessEvent event = createAccessEvent();
+ appender.append(event);
+
+ Statement stmt = connectionSource.getConnection().createStatement();
+ ResultSet rs = null;
+ rs = stmt.executeQuery("SELECT * FROM access_event_header");
+ String key;
+ String value;
+ if (!rs.next()) {
+ fail("There should be results to this query");
+ } else {
+ key = rs.getString(2);
+ value = rs.getString(3);
+ assertNotNull(key);
+ assertNotNull(value);
+ assertEquals(event.getRequestHeader(key), value);
+ rs.next();
+ key = rs.getString(2);
+ value = rs.getString(3);
+ assertNotNull(key);
+ assertNotNull(value);
+ assertEquals(event.getRequestHeader(key), value);
+ }
+ if (rs.next()) {
+ fail("There should be no more rows available");
+ }
+
+ rs.close();
+ stmt.close();
+ }
+
+ @Test
+ public void testAppendMultipleEvents() throws SQLException {
+ String uri = "testAppendMultipleEvents";
+ for (int i = 0; i < 10; i++) {
+ AccessEvent event = createAccessEvent(uri);
+ appender.append(event);
+ }
+
+ Statement stmt = connectionSource.getConnection().createStatement();
+ ResultSet rs = null;
+ rs = stmt.executeQuery("SELECT * FROM access_event where requestURI='"+uri+"'");
+ int count = 0;
+ while (rs.next()) {
+ count++;
+ }
+ assertEquals(10, count);
+
+ rs.close();
+ stmt.close();
+ }
+
+ private AccessEvent createAccessEvent() {
+ return createAccessEvent("");
+ }
+
+ private AccessEvent createAccessEvent(String uri) {
+ DummyRequest request = new DummyRequest();
+ request.setRequestUri(uri);
+ DummyResponse response = new DummyResponse();
+ DummyServerAdapter adapter = new DummyServerAdapter(request, response);
+
+ AccessEvent ae = new AccessEvent(request, response, adapter);
+ return ae;
+ }
+}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTestFixture.java b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTestFixture.java
index 828c6c14aa38b489f157146d545ec48148ecac26..4721068f7c4d92fdef13560971117b29b70bd954 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTestFixture.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTestFixture.java
@@ -1,128 +1,128 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.db;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.hsqldb.Server;
-
-public class DBAppenderTestFixture {
-
- public static final String DRIVER_CLASS = "org.hsqldb.jdbcDriver";
- String serverProps;
- String url;
- String user = "sa";
- String password = "";
- Server server;
- boolean isNetwork = true;
-
-
- void setUp() throws SQLException {
- if (isNetwork) {
- if (url == null) {
- url = "jdbc:hsqldb:hsql://localhost/test";
- }
-
- server = new Server();
-
- server.setDatabaseName(0, "test");
- server.setDatabasePath(0, "mem:test;sql.enforce_strict_size=true");
- server.setLogWriter(null);
- server.setErrWriter(null);
- server.setTrace(false);
- server.setSilent(true);
- server.start();
- } else {
- if (url == null) {
- url = "jdbc:hsqldb:file:test;sql.enforce_strict_size=true";
- }
- }
-
- try {
- Class.forName(DRIVER_CLASS);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println(this + ".setUp() error: " + e.getMessage());
- }
- Thread.yield();
-
- createTables();
- }
-
- void tearDown() throws SQLException {
- dropTables();
- if (isNetwork) {
- server.stop();
- server = null;
- }
- }
-
- Connection newConnection() throws SQLException {
- return DriverManager.getConnection(url, user, password);
- }
-
- private void createTables() throws SQLException {
- Connection conn = newConnection();
- StringBuffer buf = new StringBuffer();
- buf.append("CREATE TABLE access_event (");
- buf.append("timestmp BIGINT NOT NULL,");
- buf.append("requestURI VARCHAR(254),");
- buf.append("requestURL VARCHAR(254),");
- buf.append("remoteHost VARCHAR(254),");
- buf.append("remoteUser VARCHAR(254),");
- buf.append("remoteAddr VARCHAR(254),");
- buf.append("protocol VARCHAR(254),");
- buf.append("method VARCHAR(254),");
- buf.append("serverName VARCHAR(254),");
- buf.append("postContent VARCHAR(254),");
- buf.append("event_id INT NOT NULL IDENTITY);");
- query(conn, buf.toString());
-
- buf = new StringBuffer();
- buf.append("CREATE TABLE access_event_header (");
- buf.append("event_id INT NOT NULL,");
- buf.append("header_key VARCHAR(254) NOT NULL,");
- buf.append("header_value LONGVARCHAR,");
- buf.append("PRIMARY KEY(event_id, header_key),");
- buf.append("FOREIGN KEY (event_id) REFERENCES access_event(event_id));");
- query(conn, buf.toString());
- }
-
- private void dropTables() throws SQLException {
- Connection conn = newConnection();
-
- StringBuffer buf = new StringBuffer();
- buf.append("DROP TABLE access_event_header IF EXISTS;");
- query(conn, buf.toString());
-
- buf = new StringBuffer();
- buf.append("DROP TABLE access_event IF EXISTS;");
- query(conn, buf.toString());
- }
-
- private void query(Connection conn, String expression) throws SQLException {
- Statement st = null;
- st = conn.createStatement();
-
- int i = st.executeUpdate(expression);
- if (i == -1) {
- System.out.println("db error : " + expression);
- }
-
- st.close();
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.db;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.hsqldb.Server;
+
+public class DBAppenderTestFixture {
+
+ public static final String DRIVER_CLASS = "org.hsqldb.jdbcDriver";
+ String serverProps;
+ String url;
+ String user = "sa";
+ String password = "";
+ Server server;
+ boolean isNetwork = true;
+
+
+ void setUp() throws SQLException {
+ if (isNetwork) {
+ if (url == null) {
+ url = "jdbc:hsqldb:hsql://localhost/test";
+ }
+
+ server = new Server();
+
+ server.setDatabaseName(0, "test");
+ server.setDatabasePath(0, "mem:test;sql.enforce_strict_size=true");
+ server.setLogWriter(null);
+ server.setErrWriter(null);
+ server.setTrace(false);
+ server.setSilent(true);
+ server.start();
+ } else {
+ if (url == null) {
+ url = "jdbc:hsqldb:file:test;sql.enforce_strict_size=true";
+ }
+ }
+
+ try {
+ Class.forName(DRIVER_CLASS);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println(this + ".setUp() error: " + e.getMessage());
+ }
+ Thread.yield();
+
+ createTables();
+ }
+
+ void tearDown() throws SQLException {
+ dropTables();
+ if (isNetwork) {
+ server.stop();
+ server = null;
+ }
+ }
+
+ Connection newConnection() throws SQLException {
+ return DriverManager.getConnection(url, user, password);
+ }
+
+ private void createTables() throws SQLException {
+ Connection conn = newConnection();
+ StringBuffer buf = new StringBuffer();
+ buf.append("CREATE TABLE access_event (");
+ buf.append("timestmp BIGINT NOT NULL,");
+ buf.append("requestURI VARCHAR(254),");
+ buf.append("requestURL VARCHAR(254),");
+ buf.append("remoteHost VARCHAR(254),");
+ buf.append("remoteUser VARCHAR(254),");
+ buf.append("remoteAddr VARCHAR(254),");
+ buf.append("protocol VARCHAR(254),");
+ buf.append("method VARCHAR(254),");
+ buf.append("serverName VARCHAR(254),");
+ buf.append("postContent VARCHAR(254),");
+ buf.append("event_id INT NOT NULL IDENTITY);");
+ query(conn, buf.toString());
+
+ buf = new StringBuffer();
+ buf.append("CREATE TABLE access_event_header (");
+ buf.append("event_id INT NOT NULL,");
+ buf.append("header_key VARCHAR(254) NOT NULL,");
+ buf.append("header_value LONGVARCHAR,");
+ buf.append("PRIMARY KEY(event_id, header_key),");
+ buf.append("FOREIGN KEY (event_id) REFERENCES access_event(event_id));");
+ query(conn, buf.toString());
+ }
+
+ private void dropTables() throws SQLException {
+ Connection conn = newConnection();
+
+ StringBuffer buf = new StringBuffer();
+ buf.append("DROP TABLE access_event_header IF EXISTS;");
+ query(conn, buf.toString());
+
+ buf = new StringBuffer();
+ buf.append("DROP TABLE access_event IF EXISTS;");
+ query(conn, buf.toString());
+ }
+
+ private void query(Connection conn, String expression) throws SQLException {
+ Statement st = null;
+ st = conn.createStatement();
+
+ int i = st.executeUpdate(expression);
+ if (i == -1) {
+ System.out.println("db error : " + expression);
+ }
+
+ st.close();
+ }
+}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/db/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/db/PackageTest.java
index d1b772475985d751cb12dff199f689bf78dfdca1..1d7a5abac134a6016b8dd618336a42910ff94501 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/db/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/db/PackageTest.java
@@ -1,26 +1,26 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.db;
-
-import junit.framework.*;
-
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(DBAppenderTest.class));
- suite.addTest(new JUnit4TestAdapter(DBAppenderIntegrationTest.class));
- return suite;
- }
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.db;
+
+import junit.framework.*;
+
+public class PackageTest extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new JUnit4TestAdapter(DBAppenderTest.class));
+ suite.addTest(new JUnit4TestAdapter(DBAppenderIntegrationTest.class));
+ return suite;
+ }
}
\ No newline at end of file
diff --git a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyAccessEventBuilder.java b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyAccessEventBuilder.java
index 5ebcb4021fa1d76787f005785372174c8155141e..85595cf5430887b35b2262794985d0d09f8697f3 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyAccessEventBuilder.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyAccessEventBuilder.java
@@ -1,30 +1,30 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.dummy;
-
-import ch.qos.logback.access.spi.AccessEvent;
-
-public class DummyAccessEventBuilder {
-
-
- static public AccessEvent buildNewAccessEvent() {
- DummyRequest request = new DummyRequest();
- DummyResponse response = new DummyResponse();
- DummyServerAdapter adapter = new DummyServerAdapter(request, response);
-
- AccessEvent ae = new AccessEvent(request, response, adapter);
- return ae;
- }
-
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.dummy;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class DummyAccessEventBuilder {
+
+
+ static public AccessEvent buildNewAccessEvent() {
+ DummyRequest request = new DummyRequest();
+ DummyResponse response = new DummyResponse();
+ DummyServerAdapter adapter = new DummyServerAdapter(request, response);
+
+ AccessEvent ae = new AccessEvent(request, response, adapter);
+ return ae;
+ }
+
+}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java
index 76353f35d201e6e870cdf6c912a2181c6d914368..9086fe14b1ae051ea8f4cb1f62d9c0fe6130b6a6 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java
@@ -1,277 +1,277 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.dummy;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.security.Principal;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import ch.qos.logback.access.AccessConstants;
-
-public class DummyRequest implements HttpServletRequest {
-
- public final static String DUMMY_CONTENT_STRING = "request contents";
- public final static byte[] DUMMY_CONTENT_BYTES = DUMMY_CONTENT_STRING.getBytes();
-
-
- public static final String DUMMY_RESPONSE_CONTENT_STRING = "response contents";
- public static final byte[] DUMMY_RESPONSE_CONTENT_BYTES =DUMMY_RESPONSE_CONTENT_STRING.getBytes();
-
- Hashtable headerNames;
- String uri;
-
- public DummyRequest() {
- headerNames = new Hashtable();
- headerNames.put("headerName1", "headerValue1");
- headerNames.put("headerName2", "headerValue2");
- }
-
- public String getAuthType() {
- return null;
- }
-
- public String getContextPath() {
- return null;
- }
-
- public Cookie[] getCookies() {
- Cookie cookie = new Cookie("testName", "testCookie");
- return new Cookie[] { cookie };
- }
-
- public long getDateHeader(String arg0) {
- return 0;
- }
-
- public String getHeader(String key) {
- return headerNames.get(key);
- }
-
- public Enumeration getHeaderNames() {
- return headerNames.keys();
- }
-
- public Enumeration getHeaders(String arg0) {
- return null;
- }
-
- public int getIntHeader(String arg0) {
- return 0;
- }
-
- public String getMethod() {
- return "testMethod";
- }
-
- public String getPathInfo() {
- return null;
- }
-
- public String getPathTranslated() {
- return null;
- }
-
- public String getQueryString() {
- return null;
- }
-
- public String getRemoteUser() {
- return "testUser";
- }
-
- public String getRequestURI() {
- return uri;
- }
-
- public StringBuffer getRequestURL() {
- return new StringBuffer(uri);
- }
-
- public String getRequestedSessionId() {
- return null;
- }
-
- public String getServletPath() {
- return null;
- }
-
- public HttpSession getSession() {
- return null;
- }
-
- public HttpSession getSession(boolean arg0) {
- return null;
- }
-
- public Principal getUserPrincipal() {
- return null;
- }
-
- public boolean isRequestedSessionIdFromCookie() {
- return false;
- }
-
- public boolean isRequestedSessionIdFromURL() {
- return false;
- }
-
- public boolean isRequestedSessionIdFromUrl() {
- return false;
- }
-
- public boolean isRequestedSessionIdValid() {
- return false;
- }
-
- public boolean isUserInRole(String arg0) {
- return false;
- }
-
- public Object getAttribute(String key) {
- if (key.equals("testKey")) {
- return "testKey";
- } else if (AccessConstants.LB_INPUT_BUFFER.equals(key)) {
- return DUMMY_CONTENT_BYTES;
- } else if (AccessConstants.LB_OUTPUT_BUFFER.equals(key)) {
- return DUMMY_RESPONSE_CONTENT_BYTES;
- } else {
- return null;
- }
- }
-
- public Enumeration getAttributeNames() {
- return null;
- }
-
- public String getCharacterEncoding() {
- return null;
- }
-
- public int getContentLength() {
- return 0;
- }
-
- public String getContentType() {
- return null;
- }
-
- public ServletInputStream getInputStream() throws IOException {
- return null;
- }
-
- public String getLocalAddr() {
- return null;
- }
-
- public String getLocalName() {
- return null;
- }
-
- public int getLocalPort() {
- return 11;
- }
-
- public Locale getLocale() {
- return null;
- }
-
- public Enumeration getLocales() {
- return null;
- }
-
- public String getParameter(String arg0) {
- return null;
- }
-
- public Map getParameterMap() {
- return null;
- }
-
- public Enumeration getParameterNames() {
- return null;
- }
-
- public String[] getParameterValues(String arg0) {
- return null;
- }
-
- public String getProtocol() {
- return "testProtocol";
- }
-
- public BufferedReader getReader() throws IOException {
- return null;
- }
-
- public String getRealPath(String arg0) {
- return null;
- }
-
- public String getRemoteAddr() {
- return "testRemoteAddress";
- }
-
- public String getRemoteHost() {
- return "testHost";
- }
-
- public int getRemotePort() {
- return 0;
- }
-
- public RequestDispatcher getRequestDispatcher(String arg0) {
- return null;
- }
-
- public String getScheme() {
- return null;
- }
-
- public String getServerName() {
- return "testServerName";
- }
-
- public int getServerPort() {
- return 0;
- }
-
- public boolean isSecure() {
- return false;
- }
-
- public void removeAttribute(String arg0) {
- }
-
- public void setAttribute(String arg0, Object arg1) {
- }
-
- public void setCharacterEncoding(String arg0)
- throws UnsupportedEncodingException {
- }
-
- public void setRequestUri(String uri) {
- this.uri = uri;
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.access.dummy;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import ch.qos.logback.access.AccessConstants;
+
+public class DummyRequest implements HttpServletRequest {
+
+ public final static String DUMMY_CONTENT_STRING = "request contents";
+ public final static byte[] DUMMY_CONTENT_BYTES = DUMMY_CONTENT_STRING.getBytes();
+
+
+ public static final String DUMMY_RESPONSE_CONTENT_STRING = "response contents";
+ public static final byte[] DUMMY_RESPONSE_CONTENT_BYTES =DUMMY_RESPONSE_CONTENT_STRING.getBytes();
+
+ Hashtable headerNames;
+ String uri;
+
+ public DummyRequest() {
+ headerNames = new Hashtable();
+ headerNames.put("headerName1", "headerValue1");
+ headerNames.put("headerName2", "headerValue2");
+ }
+
+ public String getAuthType() {
+ return null;
+ }
+
+ public String getContextPath() {
+ return null;
+ }
+
+ public Cookie[] getCookies() {
+ Cookie cookie = new Cookie("testName", "testCookie");
+ return new Cookie[] { cookie };
+ }
+
+ public long getDateHeader(String arg0) {
+ return 0;
+ }
+
+ public String getHeader(String key) {
+ return headerNames.get(key);
+ }
+
+ public Enumeration getHeaderNames() {
+ return headerNames.keys();
+ }
+
+ public Enumeration getHeaders(String arg0) {
+ return null;
+ }
+
+ public int getIntHeader(String arg0) {
+ return 0;
+ }
+
+ public String getMethod() {
+ return "testMethod";
+ }
+
+ public String getPathInfo() {
+ return null;
+ }
+
+ public String getPathTranslated() {
+ return null;
+ }
+
+ public String getQueryString() {
+ return null;
+ }
+
+ public String getRemoteUser() {
+ return "testUser";
+ }
+
+ public String getRequestURI() {
+ return uri;
+ }
+
+ public StringBuffer getRequestURL() {
+ return new StringBuffer(uri);
+ }
+
+ public String getRequestedSessionId() {
+ return null;
+ }
+
+ public String getServletPath() {
+ return null;
+ }
+
+ public HttpSession getSession() {
+ return null;
+ }
+
+ public HttpSession getSession(boolean arg0) {
+ return null;
+ }
+
+ public Principal getUserPrincipal() {
+ return null;
+ }
+
+ public boolean isRequestedSessionIdFromCookie() {
+ return false;
+ }
+
+ public boolean isRequestedSessionIdFromURL() {
+ return false;
+ }
+
+ public boolean isRequestedSessionIdFromUrl() {
+ return false;
+ }
+
+ public boolean isRequestedSessionIdValid() {
+ return false;
+ }
+
+ public boolean isUserInRole(String arg0) {
+ return false;
+ }
+
+ public Object getAttribute(String key) {
+ if (key.equals("testKey")) {
+ return "testKey";
+ } else if (AccessConstants.LB_INPUT_BUFFER.equals(key)) {
+ return DUMMY_CONTENT_BYTES;
+ } else if (AccessConstants.LB_OUTPUT_BUFFER.equals(key)) {
+ return DUMMY_RESPONSE_CONTENT_BYTES;
+ } else {
+ return null;
+ }
+ }
+
+ public Enumeration getAttributeNames() {
+ return null;
+ }
+
+ public String getCharacterEncoding() {
+ return null;
+ }
+
+ public int getContentLength() {
+ return 0;
+ }
+
+ public String getContentType() {
+ return null;
+ }
+
+ public ServletInputStream getInputStream() throws IOException {
+ return null;
+ }
+
+ public String getLocalAddr() {
+ return null;
+ }
+
+ public String getLocalName() {
+ return null;
+ }
+
+ public int getLocalPort() {
+ return 11;
+ }
+
+ public Locale getLocale() {
+ return null;
+ }
+
+ public Enumeration getLocales() {
+ return null;
+ }
+
+ public String getParameter(String arg0) {
+ return null;
+ }
+
+ public Map getParameterMap() {
+ return null;
+ }
+
+ public Enumeration getParameterNames() {
+ return null;
+ }
+
+ public String[] getParameterValues(String arg0) {
+ return null;
+ }
+
+ public String getProtocol() {
+ return "testProtocol";
+ }
+
+ public BufferedReader getReader() throws IOException {
+ return null;
+ }
+
+ public String getRealPath(String arg0) {
+ return null;
+ }
+
+ public String getRemoteAddr() {
+ return "testRemoteAddress";
+ }
+
+ public String getRemoteHost() {
+ return "testHost";
+ }
+
+ public int getRemotePort() {
+ return 0;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0) {
+ return null;
+ }
+
+ public String getScheme() {
+ return null;
+ }
+
+ public String getServerName() {
+ return "testServerName";
+ }
+
+ public int getServerPort() {
+ return 0;
+ }
+
+ public boolean isSecure() {
+ return false;
+ }
+
+ public void removeAttribute(String arg0) {
+ }
+
+ public void setAttribute(String arg0, Object arg1) {
+ }
+
+ public void setCharacterEncoding(String arg0)
+ throws UnsupportedEncodingException {
+ }
+
+ public void setRequestUri(String uri) {
+ this.uri = uri;
+ }
+}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java
index fa67980cf3bc117379cd6f506fe3a1150dff9eaa..f26effebfd912984f4491f5c485d1958d0a215d6 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java
@@ -1,165 +1,165 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.access.dummy;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-
-public class DummyResponse implements HttpServletResponse {
-
- public static final int DUMMY_DEFAULT_STATUS = 200;
- public static final int DUMMY_DEFAULT_CONTENT_COUNT = 1000;
- public static final Map DUMMY_DEFAULT_HDEADER_MAP = new HashMap