diff --git a/logback-access/pom.xml b/logback-access/pom.xml
index 13df6b597a1c870e06faf3a8e3ef8b427a23416c..db92f932e2db961cb4de526078f05b31ecd54827 100755
--- a/logback-access/pom.xml
+++ b/logback-access/pom.xml
@@ -7,7 +7,7 @@
ch.qos.logbacklogback-parent
- 1.0.12-SNAPSHOT
+ 2.0.0-SNAPSHOTlogback-access
@@ -50,14 +50,6 @@
true
-
-
-
-
-
-
-
-
org.eclipse.jettyjetty-server
@@ -65,13 +57,6 @@
true
-
-
-
-
-
-
-
org.codehaus.janinojanino
@@ -99,9 +84,10 @@
org.apache.maven.pluginsmaven-surefire-plugin
- ${surefire.version}
+ ${maven-surefire-plugin.version}once
+
plaintrue
@@ -115,6 +101,7 @@
org.apache.maven.pluginsmaven-jar-plugin
+ ${maven-jar-plugin.version}${project.build.outputDirectory}/META-INF/MANIFEST.MF
@@ -148,6 +135,20 @@
ch.qos.logback.access.*
+
+
+ ch.qos.logback.core.rolling,
+ ch.qos.logback.core.rolling.helper,
+ javax.servlet.*;version="2.5",
+ javax.*;resolution:=optional,
+ org.apache.catalina.*;version="${tomcat.version}";resolution:=optional,
+ org.eclipse.jetty.*;version="${jetty.version}";resolution:=optional,
+ *
+ J2SE-1.5
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 30e20fcc972b3f638ad7b09b1065d8a49f275da1..ea45adc32cb97652979cdba88dc1d79f17bbb0fc 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 3ef96540120b5cb655c3f675d64728414372cfc6..601aa75fd17787021226dc0931c98522d4d35c98 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/main/java/ch/qos/logback/access/PatternLayoutEncoder.java b/logback-access/src/main/java/ch/qos/logback/access/PatternLayoutEncoder.java
index 72f86d3583123ee4dbc0241107e5bbdb218b4f94..d0c043f1417c5c047b5af0a48abd2c7963cf613e 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/PatternLayoutEncoder.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/PatternLayoutEncoder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 e3a25bca0b1c47755fa2309f5f53ca1ae65ff6a3..e07b2c1786250eff9094432c10af99a037c4ff60 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 674889a505af59d7f10d8eeb3c491378617741dc..6b8a06c0ec3175baecfbe7bc92cbe12148a744f7 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java b/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
index 0e91dc7baf5425053d064a97326482bcf177de27..e2e5a12229ee68866f151c22e9342df5d5608135 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/script/mysql.sql b/logback-access/src/main/java/ch/qos/logback/access/db/script/mysql.sql
index ca4687d19b6094a7e6e92981163eb44b16fc61fb..16e0e458e0e7d4862acb936df4c0b32e794ac16c 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/script/mysql.sql
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/script/mysql.sql
@@ -6,7 +6,7 @@
# This SQL script creates the required tables by ch.qos.logback.access.db.DBAppender.
#
-# It is intended for MySQL databases. It has been tested on MySQL 5.0.22 with
+# It is intended for MySQL databases. It has been tested on MySQL 5.5.31 with
# INNODB tables.
@@ -16,7 +16,7 @@ DROP TABLE IF EXISTS access_event;
COMMIT;
BEGIN;
-CREATE TABLE ACCESS_EVENT
+CREATE TABLE access_event
(
timestmp BIGINT NOT NULL,
requestURI VARCHAR(254),
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 a2437e73d4e53532522d21cf811133c52b9c9bc1..e9aad40ecd92849eb836976cf889908e8b3daecb 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 ec7d128a8fa177a74ef9dde0b6bd88bce614eb8e..5091476319ce7e4e5df8aec90d70eb126c902c77 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 cd6a3e6150bf58adb0e1b8cc80092d3c38d9868f..5b3c17a121d9589a081b8589d3f8ce2c7926bc59 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 f99923d9b4afb3b486ce8563dcb2ac36e46d8dc9..c95b43c21d5e946eef1b106d9eb16905e0de73c4 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 66a370e459a8fbb37dcb3c7866a98353ca5be591..6c11568e859b4f2803f59dcffbcfb16e95aa2717 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 d80f0abef926b58a3b8e024fd3d1af9784bb94fb..2e2d7e781cc3dce6f6bdabf66559e6a7a7416dad 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 60d9333e905889663250830d340c7c84d0152ede..16bb262563cb3184faa0d6eb52b8e756a51201e0 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 1fa91cc901ec090b02bbd1e6db5ef6058c6d0a22..ce34b4b1d36ea30eda80bf9ef87aea4275aad92f 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 c42a796ec33eb9816ac584c510e133289ba1ece4..81b845e4d28385c1fc82616ff47e86ef5d7a7199 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 bec5c28affe399b9ba4cd7ffcbfa7c7bb41453f1..fb0c26e8cf3046d87f82b405d9fa14768ac9094d 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 5f23676d2c9936eac14f82b08db09e187aad75bd..4f3132186fb6302dda0f7b65f3c937cbedb7d311 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 aea01f65df492e39fcbc8f7860eba92a81337ae6..1202bfbeee0a35666132dba60c98a0eb5f20538c 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 877b84b4535287421fdf6d35ad9f211a392d5783..44ca2bc7fe76befb9585cfc5cb1f9b80909a2970 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 c2bb9711ae428c95dd6e71e46e9ec76161ec2fe9..16f382c6537d0782c0f6984a0646cb7ec810468a 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 6eddce35cf81d84cba99314ed7a6f001ce355a9f..b81ca74a2141dd32e96d5de6e858e4e6df53a51a 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/main/java/ch/qos/logback/access/joran/JoranConfigurator.java b/logback-access/src/main/java/ch/qos/logback/access/joran/JoranConfigurator.java
index 9ad01a159ec73820c8b6eaec0af1a4b55bf8c2d0..50c7ae1045de76cfb5b5ec884670ba433107c184 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/joran/JoranConfigurator.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/joran/JoranConfigurator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -19,8 +19,6 @@ import ch.qos.logback.access.PatternLayoutEncoder;
import ch.qos.logback.access.boolex.JaninoEventEvaluator;
import ch.qos.logback.access.joran.action.ConfigurationAction;
import ch.qos.logback.access.joran.action.EvaluatorAction;
-import ch.qos.logback.access.net.SSLSocketAppender;
-import ch.qos.logback.access.net.server.SSLServerSocketAppender;
import ch.qos.logback.access.sift.SiftAction;
import ch.qos.logback.core.AppenderBase;
import ch.qos.logback.core.UnsynchronizedAppenderBase;
@@ -33,9 +31,8 @@ import ch.qos.logback.core.joran.conditional.ElseAction;
import ch.qos.logback.core.joran.conditional.IfAction;
import ch.qos.logback.core.joran.conditional.ThenAction;
import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
-import ch.qos.logback.core.joran.spi.Pattern;
+import ch.qos.logback.core.joran.spi.ElementSelector;
import ch.qos.logback.core.joran.spi.RuleStore;
-import ch.qos.logback.core.net.ssl.SSLConfiguration;
import ch.qos.logback.core.net.ssl.SSLNestedComponentRegistryRules;
@@ -51,22 +48,22 @@ public class JoranConfigurator extends JoranConfiguratorBase {
public void addInstanceRules(RuleStore rs) {
super.addInstanceRules(rs);
- rs.addRule(new Pattern("configuration"), new ConfigurationAction());
- rs.addRule(new Pattern("configuration/appender-ref"), new AppenderRefAction());
+ rs.addRule(new ElementSelector("configuration"), new ConfigurationAction());
+ rs.addRule(new ElementSelector("configuration/appender-ref"), new AppenderRefAction());
- rs.addRule(new Pattern("configuration/appender/sift"), new SiftAction());
- rs.addRule(new Pattern("configuration/appender/sift/*"), new NOPAction());
+ rs.addRule(new ElementSelector("configuration/appender/sift"), new SiftAction());
+ rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction());
- rs.addRule(new Pattern("configuration/evaluator"), new EvaluatorAction());
+ rs.addRule(new ElementSelector("configuration/evaluator"), new EvaluatorAction());
// add if-then-else support
- rs.addRule(new Pattern("*/if"), new IfAction());
- rs.addRule(new Pattern("*/if/then"), new ThenAction());
- rs.addRule(new Pattern("*/if/then/*"), new NOPAction());
- rs.addRule(new Pattern("*/if/else"), new ElseAction());
- rs.addRule(new Pattern("*/if/else/*"), new NOPAction());
+ rs.addRule(new ElementSelector("*/if"), new IfAction());
+ rs.addRule(new ElementSelector("*/if/then"), new ThenAction());
+ rs.addRule(new ElementSelector("*/if/then/*"), new NOPAction());
+ rs.addRule(new ElementSelector("*/if/else"), new ElseAction());
+ rs.addRule(new ElementSelector("*/if/else/*"), new NOPAction());
- rs.addRule(new Pattern("configuration/include"), new IncludeAction());
+ rs.addRule(new ElementSelector("configuration/include"), new IncludeAction());
}
@Override
@@ -78,8 +75,6 @@ public class JoranConfigurator extends JoranConfiguratorBase {
registry.add(AppenderBase.class, "encoder", PatternLayoutEncoder.class);
registry.add(UnsynchronizedAppenderBase.class, "encoder", PatternLayoutEncoder.class);
- registry.add(SSLSocketAppender.class, "ssl", SSLConfiguration.class);
- registry.add(SSLServerSocketAppender.class, "ssl", SSLConfiguration.class);
SSLNestedComponentRegistryRules.addDefaultNestedComponentRegistryRules(registry);
}
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 21ea6b37138adf2248b7d8853eb6fe01ed0d8b23..fdb86351a89151786d71acf3d349ae0e7c87473f 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 b9f6c712b9111a9b8f3b21b8e80b6e10db6fb4b5..527916e9276f98dd5888413e77e022375111944e 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 fa04e036303b1ae2cff356711e2cce03e60220ed..b5d3aa2f6110248518f1fbfc7e51fd15b3b0c7f7 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 b12bb7824bac34051bd9bc96875b1749d0b7be2c..cdee031143081e93ed13a591e5525c0141291b22 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -86,7 +86,7 @@ public class SMTPAppender extends SMTPAppenderBase {
return pl;
}
- protected boolean isEventMarkedForBufferRemoval(IAccessEvent eventObject) {
+ protected boolean eventMarksEndOfLife(IAccessEvent eventObject) {
return false;
}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/SSLSocketAppender.java b/logback-access/src/main/java/ch/qos/logback/access/net/SSLSocketAppender.java
index d23203aafdaf1707fb07939f2a085eafb814184a..f3de0bf3388e6a0485775e940b041a99b8e2fffb 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/SSLSocketAppender.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/SSLSocketAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -16,7 +16,7 @@ package ch.qos.logback.access.net;
import java.net.InetAddress;
import ch.qos.logback.access.spi.IAccessEvent;
-import ch.qos.logback.core.net.SSLSocketAppenderBase;
+import ch.qos.logback.core.net.AbstractSSLSocketAppender;
import ch.qos.logback.core.spi.PreSerializationTransformer;
/**
@@ -27,7 +27,7 @@ import ch.qos.logback.core.spi.PreSerializationTransformer;
*
* @author Carl Harris
*/
-public class SSLSocketAppender extends SSLSocketAppenderBase {
+public class SSLSocketAppender extends AbstractSSLSocketAppender {
private final PreSerializationTransformer pst =
new AccessEventPreSerializationTransformer();
@@ -38,16 +38,17 @@ public class SSLSocketAppender extends SSLSocketAppenderBase {
/**
* Connects to remote server at address and port.
*/
+ @Deprecated
public SSLSocketAppender(String host, int port) {
- this(getAddressByName(host), port);
+ super(host, port);
}
/**
* Connects to remote server at address and port.
*/
+ @Deprecated
public SSLSocketAppender(InetAddress address, int port) {
- this.address = address;
- this.port = port;
+ super(address.getHostAddress(), port);
}
@Override
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/SimpleSocketServer.java b/logback-access/src/main/java/ch/qos/logback/access/net/SimpleSocketServer.java
index ff51aeea55ee7f5bc9332e4122bfb1f6bc74066b..6031f408fac7c78e017d8571fcb225474ce4bb6a 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/SimpleSocketServer.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/SimpleSocketServer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/SocketAppender.java b/logback-access/src/main/java/ch/qos/logback/access/net/SocketAppender.java
index e600389d6688099196e91a0b1f6746aafd75c8b3..4004a06be0771635520a68cc159a81a75b18cc61 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/SocketAppender.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/SocketAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -17,7 +17,7 @@ package ch.qos.logback.access.net;
import java.net.InetAddress;
import ch.qos.logback.access.spi.IAccessEvent;
-import ch.qos.logback.core.net.SocketAppenderBase;
+import ch.qos.logback.core.net.AbstractSocketAppender;
import ch.qos.logback.core.spi.PreSerializationTransformer;
/**
@@ -32,7 +32,7 @@ import ch.qos.logback.core.spi.PreSerializationTransformer;
*
*/
-public class SocketAppender extends SocketAppenderBase {
+public class SocketAppender extends AbstractSocketAppender {
PreSerializationTransformer pst = new AccessEventPreSerializationTransformer();
@@ -42,19 +42,17 @@ public class SocketAppender extends SocketAppenderBase {
/**
* Connects to remote server at address and port.
*/
+ @Deprecated
public SocketAppender(InetAddress address, int port) {
- this.address = address;
- this.remoteHost = address.getHostName();
- this.port = port;
+ super(address.getHostAddress(), port);
}
/**
* Connects to remote server at host and port.
*/
+ @Deprecated
public SocketAppender(String host, int port) {
- this.port = port;
- this.address = getAddressByName(host);
- this.remoteHost = host;
+ super(host, port);
}
@Override
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/SocketNode.java b/logback-access/src/main/java/ch/qos/logback/access/net/SocketNode.java
index 5c08870ba849d9a0581525557b7a4ef90839c172..4b8acf49d5096ebf68172958b8a960e0e430ddf0 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/SocketNode.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/SocketNode.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 e638a8f5461146cc662e205e8026aa0231999b3c..589e452a1ab7b49dbd4e0430f3afb9fd97573ff8 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/server/SSLServerSocketAppender.java b/logback-access/src/main/java/ch/qos/logback/access/net/server/SSLServerSocketAppender.java
index 67826f6a4291d6c70c47c33c8ee3f3d7ad650465..6c010ddd12d48ea29af03bec848eb4970f2a0714 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/server/SSLServerSocketAppender.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/server/SSLServerSocketAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/server/ServerSocketAppender.java b/logback-access/src/main/java/ch/qos/logback/access/net/server/ServerSocketAppender.java
index 3981cbfda4454e75623a9240f26870b6b73f0f94..775fc93d9d3990a6ff2e41a107bca4e2ff852c02 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/server/ServerSocketAppender.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/server/ServerSocketAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -15,7 +15,7 @@ package ch.qos.logback.access.net.server;
import ch.qos.logback.access.net.AccessEventPreSerializationTransformer;
import ch.qos.logback.access.spi.IAccessEvent;
-import ch.qos.logback.core.net.server.ServerSocketAppenderBase;
+import ch.qos.logback.core.net.server.AbstractServerSocketAppender;
import ch.qos.logback.core.spi.PreSerializationTransformer;
/**
@@ -26,7 +26,7 @@ import ch.qos.logback.core.spi.PreSerializationTransformer;
* @author Carl Harris
*/
public class ServerSocketAppender
- extends ServerSocketAppenderBase {
+ extends AbstractServerSocketAppender {
private static final PreSerializationTransformer pst =
new AccessEventPreSerializationTransformer();
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 c3c74dbe38467c5ed5d2f1f4d63ce8bef3421518..c28214b94ef56c7f625b1ad9b6fb104448c84aa3 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 f4188fe073405f3933b9d20c795aca529aa29b83..7ac7ac847a99c164dae36bef1caa6d870ec1df88 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 f6a005b8c0770fd9e312a40e9f4eead9c5851ede..08830c66ca768a2134cf8881591fb49b1d48a746 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 566d5aa5744ba2a2c41de63ca0826eab6418f36f..28bad5fabb347893fbebe8d963009e4d1ef5fe0f 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 81e4f0724f1d7999d3a04cd16cbe2a58a2c8605b..ed78a4a55e366228ded9abce475aac0ac4c6fa2b 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 39505de1ebbe525758dbe8ff7a9d08fa5f1a9d15..57bd1af8596df9949270f90aec643ed64cad3019 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 31d5072814f811d0acc667074def7096b0ecffa6..d9be9120c9738de4c905d33628850822bcdbfe12 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 db122890d743f2d144721d1d900a3ac254b1feda..ec844848b81d1ded933320517a180398ea8926de 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 ac85063e9f0a6e2b3100efaa7aa551341e3d5599..f23f8ce8ce856824511f6fe81ab0043de950061b 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 6bf271bb7e5ca3e42920fb0b22dd495b8a36ddbc..c86f3bf81fa825388c5317ed249238b66a3b9568 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 741c640373dc6400016fd11afcbdb85e50758718..145691e0c6ab8c52a5ec969c30074f079e2f9b15 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 1cef0b696f90046386273a0889c799cde21cca1d..31e24c15383dbe91fac27dfec20850a2c7acfbd4 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 7c36e779549903667e859c84e4df9283f4ced114..655e362905310ba76abac772c80784add6e98abc 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 ba43270aacc767bc61709b9b8ede63b7ad0e6451..bbf8a291c3a4ba7466fa7f50e0a20b37f8f4358c 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 79c6904a188ce66f222c7c1342cacc3374d1f21c..22e85becdfa0e3fd04f1a5ba925b1fc5226c3e13 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 9d34d925f5cc649b2824cefb0e5b1574ac99c89c..b5b49a80b5e8d8a5c64f6a48f5e68c4e0d5bcc52 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 488fae1ab2f4ce1b118e499487e1c0a842e8a8dc..d1d4f52f5e56c31682e556d9195fbed8f048e870 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 8b44c5f1ee8cca29eb2dad775f471f4ac31c8ad7..6e3d3bf735e19cce84acc09aafd7c678c0f415dc 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 8c36e74d19e9cf8ec65acd4e160575181596a775..b18a83faf13c2d05f556dae60b9754d150a2c6f2 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 bcc444f52c3fc202e530c06326572d237b2871b9..d2804fd61aa4b35c8c2dd63236e01f735a99e83c 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 5847c335c84e202eb80b866ac2282673180f229a..fa1db1e1ef3dfe3ae8d1c5ff73dec7b4e8a362e0 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 ce92e1ff7d27f306b53d40970b3d3884d358d92c..de09637a6828ec64575f4787595216d7dca51f5f 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 82195a91777c3bdd9cbd714c26886588b53d5bba..14e89289c8b4ba0842d78c8e839a8083c753c95d 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 75024487a7fc8b296de69bfd69140d354495302a..0945c101b7037a211587db0af89ff30a41b5f051 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 82a3259b0c749ee13bfd9a20fdbb34745bdc1cbd..0cb53c16a96564034e0f7f883adf11a004ba7f26 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 c212d33a3947c136c72f0daa7b4650fad0162333..3c18f8a18c6224c1856285b3702b3b5e3bdd8743 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 7e317483f755f2af5d82cb7fa504ffa53428a960..180374b95fe69442cfd139bbd5e6c9679c4ab2da 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 86219fc09a93a276db754065a4ab4f1334eb8108..1eb3cb536dc8575e38e9dee7c16d923e2cbccbe8 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 845b8cf9c372e2a271fa1d4b32bfc0bb90d36eaf..227fbff86ee8ea1ce9b38933856b44430031411f 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 bc3f74fcbb1692e3c881227aafe347626175dab1..8d79ec8a7cad53e0c6c9e573bcac5d7fc57ad3d4 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 6f4a3ec64ebec6467f4451f97ae09b334118aca4..7642c3a9caf0ae543ec472605e09d0216dd0c97c 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 04ac179798d50e807e3d60779928d96f0087434f..3df1811fae542e6755063b195f301dcc3a259e4b 100755
--- 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 46bd1e4f0b392f1f5b5cf2eb2f04e01f89a251ca..5352463b1f964087957be3d72f82bd120c6af716 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -17,8 +17,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import ch.qos.logback.access.spi.IAccessEvent;
-import ch.qos.logback.core.sift.Discriminator;
-import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.sift.AbstractDiscriminator;
/**
*
@@ -30,10 +29,7 @@ import ch.qos.logback.core.spi.ContextAwareBase;
* @author Ceki Gülcü
*
*/
-public class AccessEventDiscriminator extends ContextAwareBase implements
- Discriminator {
-
- boolean started = false;
+public class AccessEventDiscriminator extends AbstractDiscriminator {
/**
* At present time the followed fields can be designated: COOKIE,
@@ -120,10 +116,7 @@ public class AccessEventDiscriminator extends ContextAwareBase implements
return null;
}
- public boolean isStarted() {
- return started;
- }
-
+ @Override
public void start() {
int errorCount = 0;
@@ -152,10 +145,6 @@ public class AccessEventDiscriminator extends ContextAwareBase implements
}
}
- public void stop() {
- started = false;
- }
-
public void setFieldName(FieldName fieldName) {
this.fieldName = fieldName;
}
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/AppenderFactoryUsingJoran.java
similarity index 61%
rename from logback-access/src/main/java/ch/qos/logback/access/sift/AppenderFactory.java
rename to logback-access/src/main/java/ch/qos/logback/access/sift/AppenderFactoryUsingJoran.java
index abff1e9e832d52a752217312e148f0554dc0b96e..2610f0389ab781a149153bf305de4883b6c20b2b 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/AppenderFactoryUsingJoran.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -14,24 +14,22 @@
package ch.qos.logback.access.sift;
import java.util.List;
+import java.util.Map;
import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.core.joran.event.SaxEvent;
-import ch.qos.logback.core.sift.AppenderFactoryBase;
+import ch.qos.logback.core.sift.AbstractAppenderFactoryUsingJoran;
import ch.qos.logback.core.sift.SiftingJoranConfiguratorBase;
-public class AppenderFactory extends AppenderFactoryBase {
+public class AppenderFactoryUsingJoran extends AbstractAppenderFactoryUsingJoran {
- String keyName;
-
- AppenderFactory(List eventList, String keyName) {
- super(eventList);
- this.keyName = keyName;
+ AppenderFactoryUsingJoran(List eventList, String key, Map parentPropertyMap) {
+ super(eventList, key, parentPropertyMap);
}
public SiftingJoranConfiguratorBase getSiftingJoranConfigurator(
String keyValue) {
- return new SiftingJoranConfigurator(keyName, keyValue);
+ return new SiftingJoranConfigurator(key, keyValue, parentPropertyMap);
}
}
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 0498f28e3814afbe51c6547f7c19e383be1ec83d..8d952440f8b3b1d3861d36c1f885fbb5f3dc1d3e 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -15,6 +15,7 @@ package ch.qos.logback.access.sift;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.xml.sax.Attributes;
@@ -39,8 +40,9 @@ public class SiftAction extends Action implements InPlayListener {
ic.removeInPlayListener(this);
Object o = ic.peekObject();
if (o instanceof SiftingAppender) {
- SiftingAppender siftingAppender = (SiftingAppender) o;
- AppenderFactory appenderFactory = new AppenderFactory(seList, siftingAppender.getDiscriminatorKey());
+ SiftingAppender siftingAppender = (SiftingAppender) o;
+ Map propertyMap = ic.getCopyOfPropertyMap();
+ AppenderFactoryUsingJoran appenderFactory = new AppenderFactoryUsingJoran(seList, siftingAppender.getDiscriminatorKey(), propertyMap);
siftingAppender.setAppenderFactory(appenderFactory);
}
}
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 31f683f8a8f661928949d44633b77fb3f3d912fd..c7e27dd4f95c0f5885b0a1bc5db7f9a96425f56a 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -40,6 +40,11 @@ public class SiftingAppender extends SiftingAppenderBase {
return event.getTimeStamp();
}
+ @Override
+ protected boolean eventMarksEndOfLife(IAccessEvent event) {
+ return false;
+ }
+
@Override
@DefaultClass(AccessEventDiscriminator.class)
public void setDiscriminator(Discriminator 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 6bec804cfe6b9ba7bbb0107b956baa0013f5622e..a91b9413b5da739eb04cf72974903d40eb64af81 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -21,29 +21,28 @@ import ch.qos.logback.access.spi.IAccessEvent;
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.ElementPath;
+import ch.qos.logback.core.joran.spi.ElementSelector;
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;
+
+ SiftingJoranConfigurator(String key, String value, Map parentPropertyMap) {
+ super(key, value, parentPropertyMap);
}
@Override
- protected Pattern initialPattern() {
- return new Pattern("configuration");
+ protected ElementPath initialElementPath() {
+ return new ElementPath("configuration");
}
@Override
protected void addInstanceRules(RuleStore rs) {
- rs.addRule(new Pattern("configuration/appender"), new AppenderAction());
+ rs.addRule(new ElementSelector("configuration/appender"), new AppenderAction());
}
@Override
@@ -54,6 +53,7 @@ public class SiftingJoranConfigurator extends
omap.put(ActionConst.APPENDER_BAG, new HashMap());
omap.put(ActionConst.FILTER_CHAIN_BAG, new HashMap());
Map propertiesMap = new HashMap();
+ propertiesMap.putAll(parentPropertyMap);
propertiesMap.put(key, value);
interpreter.setInterpretationContextPropertiesMap(propertiesMap);
}
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 716986dcf0b653b39377776ceff3d91ee02d8566..7445ad7224f9fb8771a98749b6dce973db2a4480 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 d4779ab73f92e262c4dc4c6c0a07eb86c2709af6..3b53b516bf0ddf41bcc3d01cb68279c2bbfeea4f 100755
--- 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/main/java/ch/qos/logback/access/spi/IAccessEvent.java b/logback-access/src/main/java/ch/qos/logback/access/spi/IAccessEvent.java
index abfe06fdc2330a20c31c8580876219268bffa5d5..7837d1b8d017599ba96b54f3e357fefd210b7b9f 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/spi/IAccessEvent.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/spi/IAccessEvent.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 06b2653024fa2c5dcd0a32bfce4c47a43e129ae5..b28a5796d4cbd6d59bb25c7a93f66171885207f1 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 f29036451617b420a8fa4d6a96c7d9795046ecf7..65c2ed824ba0546f64ae32e37db4e5bf42103746 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 e5656b04002cf89d810c560b190627ea93a12701..f534959aa7a018d2751bef051cd78499803cd7e4 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -19,14 +19,11 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.*;
+import java.util.concurrent.ExecutorService;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
-import ch.qos.logback.access.spi.IAccessEvent;
-//import org.apache.catalina.Lifecycle;
-import ch.qos.logback.core.spi.*;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
@@ -38,17 +35,28 @@ 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.access.spi.IAccessEvent;
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.LifeCycleManager;
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.spi.LifeCycle;
+import ch.qos.logback.core.spi.LogbackLock;
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.ExecutorServiceUtil;
import ch.qos.logback.core.util.OptionHelper;
import ch.qos.logback.core.util.StatusPrinter;
+//import org.apache.catalina.Lifecycle;
/**
* This class is an implementation of tomcat's Valve interface, by extending
@@ -68,6 +76,8 @@ public class LogbackValve extends ValveBase implements Lifecycle, Context,
public final static String DEFAULT_CONFIG_FILE = "conf" + File.separatorChar
+ "logback-access.xml";
+ private final LifeCycleManager lifeCycleManager = new LifeCycleManager();
+
private long birthTime = System.currentTimeMillis();
LogbackLock configurationLock = new LogbackLock();
@@ -87,10 +97,7 @@ public class LogbackValve extends ValveBase implements Lifecycle, Context,
boolean started;
boolean alreadySetLogbackStatusManager = false;
- // 0 idle threads, 2 maximum threads, no idle waiting
- ExecutorService executorService = new ThreadPoolExecutor(0, 2,
- 0L, TimeUnit.MILLISECONDS,
- new LinkedBlockingQueue());
+ private ExecutorService executorService;
public LogbackValve() {
putObject(CoreConstants.EVALUATOR_MAP, new HashMap());
@@ -101,12 +108,23 @@ public class LogbackValve extends ValveBase implements Lifecycle, Context,
}
public void startInternal() throws LifecycleException {
- System.out.println("***startInternal() called");
+ executorService = ExecutorServiceUtil.newExecutorService();
if (filename == null) {
- String tomcatHomeProperty = OptionHelper
- .getSystemProperty("catalina.home");
-
- filename = tomcatHomeProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
+ String tomcatBaseProperty = OptionHelper
+ .getSystemProperty("catalina.base");
+
+ filename = tomcatBaseProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
+
+ File baseConfigFile = new File(filename);
+ if (!baseConfigFile.exists()) {
+
+ String tomcatHomeProperty = OptionHelper
+ .getSystemProperty("catalina.home");
+
+ filename = tomcatHomeProperty + File.separatorChar
+ + DEFAULT_CONFIG_FILE;
+ }
+
getStatusManager().add(
new InfoStatus("filename property not set. Assuming [" + filename
+ "]", this));
@@ -115,7 +133,6 @@ public class LogbackValve extends ValveBase implements Lifecycle, Context,
if (configFile.exists()) {
try {
- System.out.println("***startInternal() JoranConfigurator");
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(this);
jc.doConfigure(filename);
@@ -188,6 +205,11 @@ public class LogbackValve extends ValveBase implements Lifecycle, Context,
protected void stopInternal() throws LifecycleException {
started = false;
setState(LifecycleState.STOPPING);
+ lifeCycleManager.reset();
+ if (executorService != null) {
+ ExecutorServiceUtil.shutdown(executorService);
+ executorService = null;
+ }
}
public void addAppender(Appender newAppender) {
@@ -292,6 +314,10 @@ public class LogbackValve extends ValveBase implements Lifecycle, Context,
return configurationLock;
}
+ public void register(LifeCycle component) {
+ lifeCycleManager.register(component);
+ }
+
// ====== Methods from catalina Lifecycle =====
public void addLifecycleListener(LifecycleListener arg0) {
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 fde500875f81ff828fd0155990592998052b6dd1..5e8cc1f184780a31210bc61c47412f042648ffcc 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 b490949b97d233f0cab040d46d0d1295c96888f3..a66243752d3abac9ae06b8cc69f0a2afb32d2ec7 100755
--- 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 6632f163414d6e2645f03891e81f48918dac3327..5340742b6e01ed53b7e86d3b4fb2f4c0835e2ea5 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/boolex/JaninoEventEvaluatorTest.java b/logback-access/src/test/java/ch/qos/logback/access/boolex/JaninoEventEvaluatorTest.java
index daa18e78d12e3179c4a48416247f3dcb84e60e97..34d10017c4168ea5ae6e97609c42f7eef637d23f 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/boolex/JaninoEventEvaluatorTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/boolex/JaninoEventEvaluatorTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/boolex/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/boolex/PackageTest.java
index 9e615392a450e4148f2181f919930260fadbb22c..ed7e82f3dbe17dc454ade89c6465f0e22eab1881 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/boolex/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/boolex/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderHSQLTest.java b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderHSQLTest.java
index 6a5a3913bad68608cc6a8834667334498029b84d..013dcd7b2a9137be376b1c6950e191ab89fe93e5 100755
--- a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderHSQLTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderHSQLTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -45,20 +45,20 @@ public class DBAppenderHSQLTest {
DBAppender appender;
DriverManagerConnectionSource connectionSource;
- int existingRowCount;
+ int existingEventTableRowCount;
Statement stmt;
@BeforeClass
static public void fixtureSetUp() throws SQLException {
DB_APPENDER_HSQL_TEST_FIXTURE = new DBAppenderHSQLTestFixture();
DB_APPENDER_HSQL_TEST_FIXTURE.setUp();
- }
-
+ }
+
@AfterClass
- static public void fixtureTearDown() throws SQLException {
+ static public void fixtureTearDown() throws SQLException {
DB_APPENDER_HSQL_TEST_FIXTURE.tearDown();
}
-
+
@Before
public void setUp() throws SQLException {
context = new AccessContext();
@@ -76,7 +76,7 @@ public class DBAppenderHSQLTest {
appender.setConnectionSource(connectionSource);
stmt = connectionSource.getConnection().createStatement();
- existingRowCount = existingRowCount(stmt);
+ existingEventTableRowCount = existingEventTableRowCount(stmt);
}
@After
@@ -87,7 +87,7 @@ public class DBAppenderHSQLTest {
stmt.close();
}
- int existingRowCount(Statement stmt) throws SQLException {
+ int existingEventTableRowCount(Statement stmt) throws SQLException {
ResultSet rs = stmt.executeQuery("SELECT count(*) FROM access_event");
int result = -1;
if (rs.next()) {
@@ -109,10 +109,10 @@ public class DBAppenderHSQLTest {
IAccessEvent event = createAccessEvent();
appender.append(event);
-
+
Statement stmt = connectionSource.getConnection().createStatement();
ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM access_event where EVENT_ID = "+ existingRowCount);
+ rs = stmt.executeQuery("SELECT * FROM access_event where EVENT_ID = " + existingEventTableRowCount);
if (rs.next()) {
assertEquals(event.getTimeStamp(), rs.getLong(1));
assertEquals(event.getRequestURI(), rs.getString(2));
@@ -130,33 +130,33 @@ public class DBAppenderHSQLTest {
rs.close();
stmt.close();
}
-
-
+
+
@Test
public void testCheckNoHeadersAreInserted() throws Exception {
setInsertHeadersAndStart(false);
-
+
IAccessEvent 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");
-
+ rs = stmt.executeQuery("SELECT * FROM access_event_header where EVENT_ID = " + existingEventTableRowCount);
+
assertFalse(rs.next());
rs.close();
stmt.close();
}
@Test
- public void testAppendHeaders() throws SQLException {
+ public void testAppendHeaders() throws SQLException {
setInsertHeadersAndStart(true);
-
+
IAccessEvent event = createAccessEvent();
appender.append(event);
-
+
Statement stmt = connectionSource.getConnection().createStatement();
ResultSet rs = null;
rs = stmt.executeQuery("SELECT * FROM access_event_header");
@@ -195,10 +195,10 @@ public class DBAppenderHSQLTest {
}
StatusPrinter.print(context);
-
+
Statement stmt = connectionSource.getConnection().createStatement();
ResultSet rs = null;
- rs = stmt.executeQuery("SELECT * FROM access_event where requestURI='"+uri+"'");
+ rs = stmt.executeQuery("SELECT * FROM access_event where requestURI='" + uri + "'");
int count = 0;
while (rs.next()) {
count++;
@@ -210,9 +210,9 @@ public class DBAppenderHSQLTest {
}
private IAccessEvent createAccessEvent() {
- return createAccessEvent("");
+ return createAccessEvent("");
}
-
+
private IAccessEvent createAccessEvent(String uri) {
DummyRequest request = new DummyRequest();
request.setRequestUri(uri);
diff --git a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderHSQLTestFixture.java b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderHSQLTestFixture.java
index b70420a3ed4bb6d810e7700b2067faf8c8617111..7e8efa5e44a054eb57f4f9ae0f31e10a575cd005 100755
--- a/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderHSQLTestFixture.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderHSQLTestFixture.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 ec7ca9675edd2a4ec8a02d0e6615405198464897..35614fb88021ef2c137e46e24a457a1ece333b23 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 a38f5f86a5b329c35a087dc45cc55455362d6833..aa98437158ef6538e510b7d417cac88df8e8a5c2 100755
--- 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,14 +13,11 @@
*/
package ch.qos.logback.access.db;
-import junit.framework.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
-public class PackageTest extends TestCase {
+@RunWith(Suite.class)
+@Suite.SuiteClasses({DBAppenderHSQLTest.class, DBAppenderIntegrationTest.class})
+public class PackageTest {
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(DBAppenderHSQLTest.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 7916b3cc169069aaaeaaae63f01d25a93e863692..7f537c739c5c30a348e332442543aa052c816cd8 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 db3d9f277a2609bedfafec49b0808f7e14db1616..360fb923c56f8aea22153bf37f431807a1b90428 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
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 2281eec7be37bbbc886ac304a461a94c2511d2ba..ef0a28418f246b760afaeab5f36794b304015eec 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,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java
index 4053fbde3346cd187ef1aba9ed10f9f902c1177a..886cce6bb174dbd958fff9ca6d725a90c4df68ab 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/filter/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/filter/PackageTest.java
index c48fbe26603c49c5187447021f3ec3523d4dff24..174916bcf3980aca4f5badd391e18417a9b4987b 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/filter/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/filter/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/filter/StatsByDayTest.java b/logback-access/src/test/java/ch/qos/logback/access/filter/StatsByDayTest.java
index 5420d780021581275f5c6bbbc1e9748d36a93fe8..e2b92f03260ef47d5e798fcb91bad01400a07385 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/filter/StatsByDayTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/filter/StatsByDayTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyBasicTest.java b/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyBasicTest.java
index b6a9d5845fb5eea8090ce2c36c89ad3f0a8fec90..744712dcf34a2706ca869e1609a4b18ac8a0ec7b 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyBasicTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyBasicTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureBase.java b/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureBase.java
index e4279cbe13fbc0cb4c258789e7b7e598609b572e..21eb7b563ed1bb03453b71f73ce0b8353d53cf2e 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureBase.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureWithListAndConsoleAppenders.java b/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureWithListAndConsoleAppenders.java
index 9f40a10f84aea6be2f286545c1828387b2d0cf4d..bf04d51f24d55797282075dc919a160336fb1844 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureWithListAndConsoleAppenders.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/jetty/JettyFixtureWithListAndConsoleAppenders.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/jetty/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/jetty/PackageTest.java
index aa9f33f5a664d28bd4b0d13070a9443a828add7d..c9ea6d5e762cdc23001c31dd85525873b2dffa00 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/jetty/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/jetty/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java b/logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java
index 9ab337ac0e082c358e499be714768faf92eafbeb..2d7dee1d158ee7b48981bde919c9271918a33c2e 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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;
import ch.qos.logback.access.TeztConstants;
diff --git a/logback-access/src/test/java/ch/qos/logback/access/joran/JoranConfiguratorTest.java b/logback-access/src/test/java/ch/qos/logback/access/joran/JoranConfiguratorTest.java
index 7d0b5ad0054bdf640eb7816de23575b8372c16da..e7bce84c819b10e51eebbe380f4ca7e4dc4bb0e9 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/joran/JoranConfiguratorTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/joran/JoranConfiguratorTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/joran/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/joran/PackageTest.java
index b79b7cacf724a540e2d16edf247acd40f897df61..229e44e1291756a4c7e871cc077befee2b86f77d 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/joran/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/joran/PackageTest.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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;
import org.junit.runner.RunWith;
diff --git a/logback-access/src/test/java/ch/qos/logback/access/net/MockSocketServer.java b/logback-access/src/test/java/ch/qos/logback/access/net/MockSocketServer.java
deleted file mode 100644
index 10b4e00424892413318f0b401a86e7d341459493..0000000000000000000000000000000000000000
--- a/logback-access/src/test/java/ch/qos/logback/access/net/MockSocketServer.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, 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.BufferedInputStream;
-import java.io.ObjectInputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.List;
-
-//import ch.qos.logback.access.spi.AccessEvent;
-import ch.qos.logback.access.spi.IAccessEvent;
-
-
-/**
- * @author Sébastien Pennec
- */
-public class MockSocketServer extends Thread {
-
- static final int PORT = 4560;
-
- final int loopLen;
-
- List accessEventList = new ArrayList();
- boolean finished = false;
-
- MockSocketServer(int loopLen) {
- super();
- this.loopLen = loopLen;
- }
-
- @Override
- public void run() {
- ObjectInputStream ois = null;
- ServerSocket serverSocket = null;
- // Object readObject;
- try {
- serverSocket = new ServerSocket(PORT);
- Socket socket = serverSocket.accept();
- ois = new ObjectInputStream(new BufferedInputStream(socket
- .getInputStream()));
- for (int i = 0; i < loopLen; i++) {
- IAccessEvent event = (IAccessEvent) ois.readObject();
- accessEventList.add(event);
- }
- } catch (Exception se) {
- se.printStackTrace();
- } finally {
-
- if (ois != null) {
- try {
- ois.close();
- } catch (Exception e) {
- }
- }
- if (serverSocket != null) {
- try {
- serverSocket.close();
- } catch (Exception e) {
- }
- }
- }
- finished = true;
- }
-}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/net/NOPOutputStream.java b/logback-access/src/test/java/ch/qos/logback/access/net/NOPOutputStream.java
index 96127e1f606e1f39a86719abde2f62329bd44946..261177d1b7b952796330e271be45afecba1b24da 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/net/NOPOutputStream.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/net/NOPOutputStream.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/net/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/net/PackageTest.java
index 2a4d88d4aa61c34235df4c60505b3236d0b1e031..786063616e90eca518138bc369a8f5b99daa8b7e 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/net/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/net/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -20,6 +20,6 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({URLEvaluatorTest.class, SocketAppenderTest.class})
+@SuiteClasses({URLEvaluatorTest.class})
public class PackageTest extends TestCase {
}
\ No newline at end of file
diff --git a/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java b/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java
index dcc82b5f4cb8baec1aab987b60f4b08f735d9efc..318a14f8f8bf67521abfafb086bd6e59bba7e1bc 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java b/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java
deleted file mode 100644
index 0b6981a3d993b02c6a57e42909a666434b63e6f9..0000000000000000000000000000000000000000
--- a/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, 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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import ch.qos.logback.access.spi.IAccessEvent;
-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;
-
-
-public class SocketAppenderTest {
-
- private AccessContext context;
- private MockSocketServer mockSocketServer;
-
- @Test
- public void testStartFailNoRemoteHost() {
- context = new AccessContext();
- SocketAppender appender = new SocketAppender();
- appender.setContext(context);
- appender.setPort(123);
- appender.start();
- assertEquals(1, context.getStatusManager().getCount());
- }
-
- @Test
- public void testRecieveMessage() throws InterruptedException {
- startServer(1);
- configureClient();
-
- context.callAppenders(buildNewAccessEvent());
- // Wait max 2 seconds for mock server to finish. However, it should
- // finish much sooner than that.
- mockSocketServer.join(2000);
- assertTrue(mockSocketServer.finished);
- assertEquals(1, mockSocketServer.accessEventList.size());
-
- IAccessEvent remoteEvent = mockSocketServer.accessEventList.get(0);
- //check that the values are available although the request and response
- //objects did not survive serialization
- assertEquals("headerValue1", remoteEvent.getRequestHeader("headerName1"));
- assertEquals("testHost", remoteEvent.getRemoteHost());
- }
-
- private void startServer(int expectedEventNumber) throws InterruptedException {
- mockSocketServer = new MockSocketServer(expectedEventNumber);
- mockSocketServer.start();
- // give MockSocketServer head start
- Thread.sleep(100);
- }
-
- private void configureClient() {
- context = new AccessContext();
- context.setName("test");
- SocketAppender socketAppender = new SocketAppender();
- socketAppender.setContext(context);
- socketAppender.setName("socket");
- socketAppender.setPort(MockSocketServer.PORT);
- socketAppender.setRemoteHost("localhost");
- context.addAppender(socketAppender);
- socketAppender.start();
- }
-
- private IAccessEvent buildNewAccessEvent() {
- DummyRequest request = new DummyRequest();
- DummyResponse response = new DummyResponse();
- DummyServerAdapter adapter = new DummyServerAdapter(request, response);
-
- return new AccessEvent(request, response, adapter);
- }
-}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/net/URLEvaluatorTest.java b/logback-access/src/test/java/ch/qos/logback/access/net/URLEvaluatorTest.java
index 86b47e729ca89f47f7dc5ae1c714782154a99cd3..e56ab635f3c8e7cfa3030114abcf6243182708b7 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/net/URLEvaluatorTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/net/URLEvaluatorTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java b/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java
index 812c517523f88a988413353527bd7733e14b56be..39bfb7e5ae3d17a6812ea59cb37a50af7ea980a4 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/pattern/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/pattern/PackageTest.java
index 5e5ad14c36ac0b0e6fba2b5fdf856c599dcbca0f..710ce09cb478516680704a7cfc7acb4cba4735e6 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/pattern/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/pattern/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/servlet/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/servlet/PackageTest.java
index 0bf8aa8db5177902d49156226f5fc7615aaf3cc1..7e3aa72104d7a97e98757b3d70e7c6bc8e6a0a98 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/servlet/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/servlet/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/servlet/TeeFilterTest.java b/logback-access/src/test/java/ch/qos/logback/access/servlet/TeeFilterTest.java
index 5e62088b323deb8db829cf03707adf8abb44cb51..045905db7ee1d6ac50e89b05b71ccbcb93d9127a 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/servlet/TeeFilterTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/servlet/TeeFilterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/sift/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/sift/PackageTest.java
index fb04885f5d8aca540a052f5abee1464369f6d360..5e7d738ffff2812ae57c4933db78556b59accf3f 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/sift/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/sift/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/sift/SiftingAppenderTest.java b/logback-access/src/test/java/ch/qos/logback/access/sift/SiftingAppenderTest.java
index 7e7231d6a41734c4fd0a2b83c3e8f08fa1e40b26..141a331aaff756cd75b70b6611087df921210e22 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/sift/SiftingAppenderTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/sift/SiftingAppenderTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -17,8 +17,8 @@ import static org.junit.Assert.assertEquals;
import java.net.HttpURLConnection;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.LinkedHashSet;
+import java.util.Set;
import ch.qos.logback.access.jetty.JettyFixtureBase;
import org.junit.After;
@@ -55,33 +55,31 @@ public class SiftingAppenderTest {
public void invokingDifferentPathShouldBeSiftedAccordingly() throws Exception {
rli.setFileName(PREFIX + "sifting.xml");
jettyFixture.start();
- StatusPrinter.print(rli);
invokeServer("/");
invokeServer("/x");
invokeServer("/x");
invokeServer("/y");
+ StatusPrinter.print(rli);
SiftingAppender siftingAppender = (SiftingAppender) rli
.getAppender("SIFTING");
- List keyList = siftingAppender.getAppenderTracker().keyList();
- assertEquals(3, keyList.size());
-
- List witnessList = new ArrayList();
- witnessList.add("NA");
- witnessList.add("x");
- witnessList.add("y");
- assertEquals(witnessList, keyList);
+ Set keySet = siftingAppender.getAppenderTracker().allKeys();
+ assertEquals(3, keySet.size());
- long now = System.currentTimeMillis();
- check(siftingAppender, "NA", 1, now);
- check(siftingAppender, "x", 2, now);
- check(siftingAppender, "y", 1, now);
+ Set witnessSet = new LinkedHashSet();
+ witnessSet.add("NA");
+ witnessSet.add("x");
+ witnessSet.add("y");
+ assertEquals(witnessSet, keySet);
+ check(siftingAppender, "NA", 1);
+ check(siftingAppender, "x", 2);
+ check(siftingAppender, "y", 1);
}
- private void check(SiftingAppender siftingAppender, String key, int expectedCount, long now) {
+ private void check(SiftingAppender siftingAppender, String key, int expectedCount) {
ListAppender listAppender = (ListAppender) siftingAppender
- .getAppenderTracker().get(key, now);
+ .getAppenderTracker().find(key);
assertEquals(expectedCount, listAppender.list.size());
}
diff --git a/logback-access/src/test/java/ch/qos/logback/access/spi/AccessEventSerializationTest.java b/logback-access/src/test/java/ch/qos/logback/access/spi/AccessEventSerializationTest.java
index 821eab0221dcc9557adf7781da51cf7bd7dbad13..0c36ef18d550a71008d524e7faa981171c1c8d17 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/spi/AccessEventSerializationTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/spi/AccessEventSerializationTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/spi/PackageTest.java b/logback-access/src/test/java/ch/qos/logback/access/spi/PackageTest.java
index b0d162ad80ac9f169a67ee1c4c9052118a10c4ad..4d6744710756223debed9fb5c416efae0c406b1b 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/spi/PackageTest.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/spi/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-access/src/test/java/ch/qos/logback/access/testUtil/NotifyingListAppender.java b/logback-access/src/test/java/ch/qos/logback/access/testUtil/NotifyingListAppender.java
index c87a73a9a05a168a1d7f1c827835491112a40368..7e747482ae59ca81570a6e69a8d7df97a2cfa1e3 100644
--- a/logback-access/src/test/java/ch/qos/logback/access/testUtil/NotifyingListAppender.java
+++ b/logback-access/src/test/java/ch/qos/logback/access/testUtil/NotifyingListAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml
index 9b12ee3c66ef793b2623181fc10181ac1091bd8b..fee588cdb4ce10f78d87dd818acef2ef2d3d7b2a 100755
--- a/logback-classic/pom.xml
+++ b/logback-classic/pom.xml
@@ -7,7 +7,7 @@
ch.qos.logbacklogback-parent
- 1.0.12-SNAPSHOT
+ 2.0.0-SNAPSHOTlogback-classic
@@ -196,15 +196,6 @@
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- 1.5
-
-
-
org.codehaus.gmavengmaven-plugin
@@ -235,6 +226,7 @@
org.apache.maven.pluginsmaven-jar-plugin
+ ${maven-jar-plugin.version}
@@ -308,10 +300,11 @@
org.apache.maven.pluginsmaven-surefire-plugin
- ${surefire.version}
+ ${maven-surefire-plugin.version}once
+
plainfalse
diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ComponentDelegate.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ComponentDelegate.groovy
index 6cfdf387566e36ca30cce20f5065c8cee66c58f9..98edd5e78cbe4301c99593e14461d3d32522a619 100644
--- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ComponentDelegate.groovy
+++ b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ComponentDelegate.groovy
@@ -25,7 +25,7 @@ class ComponentDelegate extends ContextAwareBase {
final Object component;
- final List fieldsToCaccade = [];
+ final List fieldsToCascade = [];
ComponentDelegate(Object component) {
this.component = component;
@@ -74,7 +74,7 @@ class ComponentDelegate extends ContextAwareBase {
}
void cascadeFields(ComponentDelegate subDelegate) {
- for (String k: fieldsToCaccade) {
+ for (String k: fieldsToCascade) {
subDelegate.metaClass."${k}" = this."${k}"
}
}
diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy
index a9a5f4a278b6a06a086aadc8fdbe6d172f79324e..8149979c3f34f5d1b05fc2370c1ebe12be70df63 100644
--- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy
+++ b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy
@@ -19,6 +19,7 @@ import ch.qos.logback.classic.Logger
import ch.qos.logback.classic.LoggerContext
import ch.qos.logback.classic.jmx.JMXConfigurator
import ch.qos.logback.classic.jmx.MBeanUtil
+import ch.qos.logback.classic.net.ReceiverBase
import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter
import ch.qos.logback.classic.turbo.TurboFilter
import ch.qos.logback.core.Appender
@@ -146,6 +147,24 @@ public class ConfigurationDelegate extends ContextAwareBase {
}
}
+ void receiver(String name, Class aClass, Closure closure = null) {
+ addInfo("About to instantiate receiver of type [" + clazz.name + "]");
+ ReceiverBase receiver = aClass.newInstance();
+ receiver.context = context;
+ if(closure != null) {
+ ComponentDelegate componentDelegate = new ComponentDelegate(receiver);
+ componentDelegate.context = context;
+ closure.delegate = componentDelegate;
+ closure.resolveStrategy = Closure.DELEGATE_FIRST
+ closure();
+ }
+ try {
+ receiver.start()
+ } catch (RuntimeException e) {
+ addError("Failed to start receiver of type [" + aClass.getName() + "]", e)
+ }
+ }
+
private void copyContributions(AppenderDelegate appenderDelegate, Appender appender) {
if (appender instanceof ConfigurationContributor) {
ConfigurationContributor cc = (ConfigurationContributor) appender;
diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/GafferConfigurator.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/GafferConfigurator.groovy
index 7e50db6aedb276b53350baf22fd593a4579ad598..fc55b3bbf775bf8c759c5c95cd480de1c0b37323 100644
--- a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/GafferConfigurator.groovy
+++ b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/GafferConfigurator.groovy
@@ -67,12 +67,13 @@ class GafferConfigurator {
protected ImportCustomizer importCustomizer() {
def customizer = new ImportCustomizer()
- customizer.addImports(PatternLayoutEncoder.class.name, SiftingAppender.class.name)
def core = 'ch.qos.logback.core'
customizer.addStarImports(core, "${core}.encoder", "${core}.read", "${core}.rolling", "${core}.status",
"ch.qos.logback.classic.net")
+ customizer.addImports(PatternLayoutEncoder.class.name)
+
customizer.addStaticStars(Level.class.name)
customizer.addStaticImport('off', Level.class.name, 'OFF')
diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/sift/GSiftingAppender.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/sift/GSiftingAppender.groovy
deleted file mode 100644
index 58c0b7d432e1a43485df8f1b7ae1fd3e88093dd0..0000000000000000000000000000000000000000
--- a/logback-classic/src/main/groovy/ch/qos/logback/classic/sift/GSiftingAppender.groovy
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2010, 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.classic.sift
-
-import ch.qos.logback.core.AppenderBase
-import ch.qos.logback.classic.spi.ILoggingEvent
-import ch.qos.logback.core.sift.AppenderTrackerImpl
-import ch.qos.logback.core.sift.Discriminator
-import ch.qos.logback.core.sift.AppenderTracker
-import ch.qos.logback.core.Appender
-
-import ch.qos.logback.classic.gaffer.ConfigurationContributor
-import ch.qos.logback.core.CoreConstants
-import ch.qos.logback.core.helpers.NOPAppender
-
-/**
- * @author Ceki Gücü
- */
-
-// The GMaven plugin does not support generics, so we use AppenderBase instead of AppenderBase
-class GSiftingAppender extends AppenderBase implements ConfigurationContributor {
-
-
- protected AppenderTracker appenderTracker = new AppenderTrackerImpl();
- Discriminator discriminator;
- Closure builderClosure;
-
- def Map getMappings() {
- return [sift: "sift"]
- }
-
- @Override
- public void start() {
- int errors = 0;
- if (discriminator == null) {
- addError("Missing discriminator. Aborting");
- errors++;
- }
- if (!discriminator?.isStarted()) {
- addError("Discriminator has not started successfully. Aborting");
- errors++;
- }
-
- if (builderClosure == null) {
- addError("Missing builder closure. Aborting");
- errors++;
- }
- if (errors == 0) {
- super.start();
- }
- }
-
- @Override
- public void stop() {
- for (Appender appender: appenderTracker.valueList()) {
- appender.stop();
- }
- }
-
- protected long getTimestamp(ILoggingEvent event) {
- return event.getTimeStamp();
- }
-
- Appender buildAppender(String value) {
- String key = getDiscriminatorKey()
-
- ZSiftingDelegate zd = new ZSiftingDelegate(getDiscriminatorKey(), value)
- zd.context = context
- zd.metaClass."$key" = value
-
- //Closure newBuilder = builderClosure.clone()
- builderClosure.delegate = zd;
- builderClosure.resolveStrategy = Closure.DELEGATE_FIRST
- Appender a = builderClosure()
- return a
- }
-
- @Override
- public void append(Object object) {
- ILoggingEvent event = (ILoggingEvent) object;
- if (!isStarted()) {
- return;
- }
-
- String discriminatingValue = discriminator.getDiscriminatingValue(event);
- long timestamp = getTimestamp(event);
-
- Appender appender = appenderTracker.get(discriminatingValue, timestamp);
- if (appender == null) {
- try {
- appender = buildAppender(discriminatingValue);
- if (appender == null) {
- appender = buildNOPAppender(discriminatingValue);
- }
- appenderTracker.put(discriminatingValue, appender, timestamp);
-
- } catch (Throwable e) {
- addError("Failed to build appender for [" + discriminatingValue + "]",
- e);
- return;
- }
- }
- appenderTracker.stopStaleAppenders(timestamp);
-
- appender.doAppend(event);
- }
-
- int nopaWarningCount = 0;
-
- NOPAppender buildNOPAppender(String discriminatingValue) {
- if (nopaWarningCount < CoreConstants.MAX_ERROR_COUNT) {
- nopaWarningCount++;
- addError("Failed to build an appender for discriminating value [" + discriminatingValue + "]");
- }
- NOPAppender nopa = new NOPAppender();
- nopa.setContext(context);
- nopa.start();
- return nopa;
- }
-
- void build() {
- int r = builderClosure();
- println "r=$r"
-
- }
-
- void sift(Closure clo) {
- builderClosure = clo;
- }
-
-
- public AppenderTracker getAppenderTracker() {
- return appenderTracker;
- }
-
- public String getDiscriminatorKey() {
- if (discriminator != null) {
- return discriminator.getKey();
- } else {
- return null;
- }
- }
-}
diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/sift/ZSiftingDelegate.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/sift/ZSiftingDelegate.groovy
deleted file mode 100644
index 8218e58a3d702faa2e98fdc68f8b559884d15dcd..0000000000000000000000000000000000000000
--- a/logback-classic/src/main/groovy/ch/qos/logback/classic/sift/ZSiftingDelegate.groovy
+++ /dev/null
@@ -1,39 +0,0 @@
-package ch.qos.logback.classic.sift
-
-import ch.qos.logback.core.spi.ContextAwareBase
-import ch.qos.logback.core.Appender
-import ch.qos.logback.classic.gaffer.AppenderDelegate
-import ch.qos.logback.core.util.StatusPrinter
-
-/**
- * @author Ceki Gücü
- */
-class ZSiftingDelegate extends ContextAwareBase {
-
- String key
- String value
-
- ZSiftingDelegate(String key, String value) {
- this.key = key
- this.value = value
- }
-
- Appender appender(String name, Class clazz, Closure closure = null) {
- addInfo("About to instantiate appender of type [" + clazz.name + "]");
- Appender appender = clazz.newInstance();
- addInfo("Naming appender as [" + name + "]");
- appender.name = name
- appender.context = context
- if (closure != null) {
- AppenderDelegate ad = new AppenderDelegate(appender);
- ad.metaClass."${key}" = value
- ad.fieldsToCaccade << "${key}"
- ad.context = context;
- closure.delegate = ad;
- closure.resolveStrategy = Closure.DELEGATE_FIRST
- closure();
- }
- appender.start();
- return appender;
- }
-}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/AsyncAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/AsyncAppender.java
index 2e0925545f8e9435bc491e7eef2ca32154e2a184..bee7299e576b2c912c20e9e46623afee0517551e 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/AsyncAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/AsyncAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2012, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/BasicConfigurator.java b/logback-classic/src/main/java/ch/qos/logback/classic/BasicConfigurator.java
index 8c8de836b83562432a3c2ede2bc2d0eeed6e0e01..93bfe3dd72159a3cb6207e3a908ba91b2323b7d0 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/BasicConfigurator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/BasicConfigurator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java b/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java
index 46e17fa71e46447a076e00fc25f31fb9b7e3e470..f673736e73ce274516b3952785eed7259c9a2033 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -45,5 +45,6 @@ public class ClassicConstants {
public static final String GAFFER_CONFIGURATOR_FQCN = "ch.qos.logback.classic.gaffer.GafferConfigurator";
- public static final Marker FINALIZE_SESSION_MARKER = MarkerFactory.getMarker("FINALIZE_SESSION");
+ public static final String FINALIZE_SESSION = "FINALIZE_SESSION";
+ public static final Marker FINALIZE_SESSION_MARKER = MarkerFactory.getMarker(FINALIZE_SESSION);
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Level.java b/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
index a6b92ad87742bc0c406735cf3c885e34b005e61e..bc43baabee4d80056eccc78cb5adeb1d267c4b79 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
index 1fdb1da526453b2b86241884960a57153b2a7912..3b594f3a0e18aab883a70b6104f65717534ca635 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java b/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
index b9cb22b822420a615ecd76a7025e8d43aaeb14fb..0ee60ea718a62272d7c72b3c0ef169a1116e397f 100755
--- a/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -58,8 +58,6 @@ public class LoggerContext extends ContextBase implements ILoggerFactory,
private int maxCallerDataDepth = ClassicConstants.DEFAULT_MAX_CALLEDER_DATA_DEPTH;
- boolean started = false;
-
int resetCount = 0;
private List frameworkPackages;
@@ -235,7 +233,7 @@ public class LoggerContext extends ContextBase implements ILoggerFactory,
}
/**
- * First stop all registered turbo filters and then clear the registration
+ * First processPriorToRemoval all registered turbo filters and then clear the registration
* list.
*/
public void resetTurboFilterList() {
@@ -329,12 +327,8 @@ public class LoggerContext extends ContextBase implements ILoggerFactory,
// === end listeners ==============================================
- public boolean isStarted() {
- return started;
- }
-
public void start() {
- started = true;
+ super.start();
fireOnStart();
}
@@ -342,7 +336,7 @@ public class LoggerContext extends ContextBase implements ILoggerFactory,
reset();
fireOnStop();
resetAllListeners();
- started = false;
+ super.stop();
}
@Override
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/PatternLayout.java b/logback-classic/src/main/java/ch/qos/logback/classic/PatternLayout.java
index 2185dd492189fb2f97cd1fef3a47bf2fcac9661c..17b184a0c2d979871123dc777a29790edc83fb7a 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/PatternLayout.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/PatternLayout.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -16,27 +16,7 @@ package ch.qos.logback.classic;
import java.util.HashMap;
import java.util.Map;
-import ch.qos.logback.classic.pattern.CallerDataConverter;
-import ch.qos.logback.classic.pattern.ClassOfCallerConverter;
-import ch.qos.logback.classic.pattern.ContextNameConverter;
-import ch.qos.logback.classic.pattern.PropertyConverter;
-import ch.qos.logback.classic.pattern.DateConverter;
-import ch.qos.logback.classic.pattern.EnsureExceptionHandling;
-import ch.qos.logback.classic.pattern.ExtendedThrowableProxyConverter;
-import ch.qos.logback.classic.pattern.FileOfCallerConverter;
-import ch.qos.logback.classic.pattern.LevelConverter;
-import ch.qos.logback.classic.pattern.LineOfCallerConverter;
-import ch.qos.logback.classic.pattern.LineSeparatorConverter;
-import ch.qos.logback.classic.pattern.LoggerConverter;
-import ch.qos.logback.classic.pattern.MDCConverter;
-import ch.qos.logback.classic.pattern.MarkerConverter;
-import ch.qos.logback.classic.pattern.MessageConverter;
-import ch.qos.logback.classic.pattern.MethodOfCallerConverter;
-import ch.qos.logback.classic.pattern.NopThrowableInformationConverter;
-import ch.qos.logback.classic.pattern.RelativeTimeConverter;
-import ch.qos.logback.classic.pattern.RootCauseFirstThrowableProxyConverter;
-import ch.qos.logback.classic.pattern.ThreadConverter;
-import ch.qos.logback.classic.pattern.ThrowableProxyConverter;
+import ch.qos.logback.classic.pattern.*;
import ch.qos.logback.classic.pattern.color.HighlightingCompositeConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.CoreConstants;
@@ -149,6 +129,7 @@ public class PatternLayout extends PatternLayoutBase {
defaultConverterMap.put("boldWhite", BoldWhiteCompositeConverter.class.getName());
defaultConverterMap.put("highlight", HighlightingCompositeConverter.class.getName());
+ defaultConverterMap.put("lsn", LocalSequenceNumberConverter.class.getName());
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/ViewStatusMessagesServlet.java b/logback-classic/src/main/java/ch/qos/logback/classic/ViewStatusMessagesServlet.java
index b040c1b724f90d625dbdaf09822060b8f48c328f..fb371952edfe2ee4092c74a4871c09eea84cc195 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/ViewStatusMessagesServlet.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/ViewStatusMessagesServlet.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/GEventEvaluator.java b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/GEventEvaluator.java
index 0fd8b4874372ecf1d74eef1c8202890f7307bdcd..c6e5ee6dcd3a80ea0f7e291f28026ceb10436107 100755
--- a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/GEventEvaluator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/GEventEvaluator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/IEvaluator.java b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/IEvaluator.java
index e20659ed5c7fe3430ef966f7bba88cc7062f461b..68ba82432407e39330f84895b828b6519cac3e0d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/IEvaluator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/IEvaluator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/JaninoEventEvaluator.java b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/JaninoEventEvaluator.java
index af911a0cdfbc5296d38c40ec3db5560ecab41f79..2c6c6270f75f0caab1b5b31c73610969920ecff1 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/JaninoEventEvaluator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/JaninoEventEvaluator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/OnErrorEvaluator.java b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/OnErrorEvaluator.java
index 5e557a4e637038af8026b2f52b564022071fe946..80baf5b8d3a19fc878c5013171a9e4508a2e63ca 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/OnErrorEvaluator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/OnErrorEvaluator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/OnMarkerEvaluator.java b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/OnMarkerEvaluator.java
index c1cdd572f114d65199b1666e627b8e45528b722c..b600340eb74bbbfa91c57d74770a235466b7cab4 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/OnMarkerEvaluator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/OnMarkerEvaluator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
index 283c7136129e9a0fde38a3c8a70e854e63b385d3..ca31bbe1e72461bf02110933ae43c9cf502c4142 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -27,7 +27,6 @@ import ch.qos.logback.classic.db.names.DefaultDBNameResolver;
import ch.qos.logback.classic.spi.*;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.db.DBAppenderBase;
-import static ch.qos.logback.core.CoreConstants.EMPTY_STRING;
/**
* The DBAppender inserts logging events into three database tables in a format
@@ -163,14 +162,23 @@ public class DBAppender extends DBAppenderBase {
void bindCallerDataWithPreparedStatement(PreparedStatement stmt,
StackTraceElement[] callerDataArray) throws SQLException {
- StackTraceElement callerData = EMPTY_CALLER_DATA;
- if(callerDataArray != null && callerDataArray[0] != null)
- callerData = callerDataArray[0];
+ StackTraceElement caller = extractFirstCaller(callerDataArray);
- stmt.setString(CALLER_FILENAME_INDEX, callerData.getFileName());
- stmt.setString(CALLER_CLASS_INDEX, callerData.getClassName());
- stmt.setString(CALLER_METHOD_INDEX, callerData.getMethodName());
- stmt.setString(CALLER_LINE_INDEX, Integer.toString(callerData.getLineNumber()));
+ stmt.setString(CALLER_FILENAME_INDEX, caller.getFileName());
+ stmt.setString(CALLER_CLASS_INDEX, caller.getClassName());
+ stmt.setString(CALLER_METHOD_INDEX, caller.getMethodName());
+ stmt.setString(CALLER_LINE_INDEX, Integer.toString(caller.getLineNumber()));
+ }
+
+ private StackTraceElement extractFirstCaller(StackTraceElement[] callerDataArray) {
+ StackTraceElement caller = EMPTY_CALLER_DATA;
+ if(hasAtLeastOneNonNullElement(callerDataArray))
+ caller = callerDataArray[0];
+ return caller;
+ }
+
+ private boolean hasAtLeastOneNonNullElement(StackTraceElement[] callerDataArray) {
+ return callerDataArray != null && callerDataArray.length > 0 && callerDataArray[0] != null;
}
Map mergePropertyMaps(ILoggingEvent event) {
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBHelper.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBHelper.java
index 7a3260747c5ae0878302721e0db2dac9689f6bf8..50bdfa679a706f7651b7e41c719b09a92abf625a 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBHelper.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBHelper.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/SQLBuilder.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/SQLBuilder.java
index 2d3c36253cf3fc718b11d8dab24b51316fa26e03..195ae0487eb09ec63e66648452d2496425d286c9 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/SQLBuilder.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/SQLBuilder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/ColumnName.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/ColumnName.java
index 9c01775c4d4c34323ea199e0a07b324ffbf920f3..e03e429057b2d71a3eb452ba4ca7ddb759ce4ff8 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/ColumnName.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/ColumnName.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DBNameResolver.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DBNameResolver.java
index cf69ff85d09f20d1ecd0fb390b0ff452dc54e6ad..d42a79402f70edfc3dc260c8ac68475cf4df78c4 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DBNameResolver.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DBNameResolver.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DefaultDBNameResolver.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DefaultDBNameResolver.java
index 992844b9638d39c87ff95f707c00f0455b4cbfbd..3946509471df016206abfbeb8a6ad0716f0e9c91 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DefaultDBNameResolver.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/DefaultDBNameResolver.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/SimpleDBNameResolver.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/SimpleDBNameResolver.java
index dd23aa283f7709d9aed93ba28741c01d47b0ba2f..ce28d84b7050fe79b5979608bffbc5903d634679 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/SimpleDBNameResolver.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/SimpleDBNameResolver.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/TableName.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/TableName.java
index 0605317bfdab177fc10b457bfdc3f00d2796f08a..bfbe286945113d1b4416ea6b573facc43ddab741 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/names/TableName.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/names/TableName.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/encoder/PatternLayoutEncoder.java b/logback-classic/src/main/java/ch/qos/logback/classic/encoder/PatternLayoutEncoder.java
index 9e9782ea29a2cfb1058f0fb18f7216805052d5e9..6ac1600d694ad94172472ea2d0002527d6ef8578 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/encoder/PatternLayoutEncoder.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/encoder/PatternLayoutEncoder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/filter/LevelFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/filter/LevelFilter.java
index d5d4ea373904811c7f30600995d543f759d86bd2..9a3537c0dbdbb93661c5cda07dbe1426ce8ce8e2 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/filter/LevelFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/filter/LevelFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/filter/ThresholdFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/filter/ThresholdFilter.java
index 953844fd5b0e674615ac785044e7591131b134c4..33117ab1f2070efc0a3760ee69fdfe7a078e6321 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/filter/ThresholdFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/filter/ThresholdFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/gaffer/GafferUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/gaffer/GafferUtil.java
index e5d121a1a386d923824ebd85b24cc5f9e4ee3432..81bdbdf75805c8ca732fd67b5f57d358f08a4adf 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/gaffer/GafferUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/gaffer/GafferUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java
index d23cb07f77f73c6ff956e1d57683a3124882da71..c7df3bef958383e9cf1e21e46d79fd4c7094765d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/helpers/MDCInsertingServletFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultCssBuilder.java b/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultCssBuilder.java
index f81ddb4a5641f1f39853ff9c959518168aeffc51..4255937d38463aadc83cd526685c4c2d6996ecb7 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultCssBuilder.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultCssBuilder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java b/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java
index c2ec351273fced2d0db8cdccbccc19933f09e75f..ea45e0e0197fe36ff410c6fc8fd6fd2522be55ca 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -50,7 +50,7 @@ public class DefaultThrowableRenderer implements
if (commonFrames > 0) {
sbuf.append(TRACE_PREFIX);
- sbuf.append("\t... " + commonFrames).append(" common frames omitted")
+ sbuf.append("\t... ").append(commonFrames).append(" common frames omitted")
.append(CoreConstants.LINE_SEPARATOR);
}
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/html/HTMLLayout.java b/logback-classic/src/main/java/ch/qos/logback/classic/html/HTMLLayout.java
index 0ea93ea98e1f1a6ae26a10e5ad5d2476f9818ebf..255301fc7887ba8578756cd536d01db0a6044205 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/html/HTMLLayout.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/html/HTMLLayout.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/html/UrlCssBuilder.java b/logback-classic/src/main/java/ch/qos/logback/classic/html/UrlCssBuilder.java
index 2ddf8c64a4af6c75f737c4136ab59837eee8d2e6..e8c408d6a6f868ac380068e0b87b2c8c06e00ad8 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/html/UrlCssBuilder.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/html/UrlCssBuilder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfigurator.java b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfigurator.java
index 0aa88cac533eeed77b46e1cedacbdfb2c51c8e4a..fe2ecf2ded652f7e61adda1dbd38bdbb1da2bd86 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfigurator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfigurator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfiguratorMBean.java b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfiguratorMBean.java
index 4cdde15c9662b9a0b27afb08057563439d27bb28..7d67a8bf78104bbed926555cb065621ef7ab5360 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfiguratorMBean.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfiguratorMBean.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/MBeanUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/MBeanUtil.java
index 5c861f76ec907d6185338462cca6ffe549b9ad30..546f40bce7ce76aca079aabedd95d25a4b58c528 100755
--- a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/MBeanUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/MBeanUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
index 4ce26cead028a0607a2e4622afd4b2cd6fb62360..64957e6dc52920c9a655abed99221f25cfe103dd 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -25,11 +25,11 @@ import ch.qos.logback.core.joran.conditional.ElseAction;
import ch.qos.logback.core.joran.conditional.IfAction;
import ch.qos.logback.core.joran.conditional.ThenAction;
import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
-import ch.qos.logback.core.joran.spi.Pattern;
+import ch.qos.logback.core.joran.spi.ElementSelector;
import ch.qos.logback.core.joran.spi.RuleStore;
/**
- * This JoranConfiguratorclass adds rules specific to logback-classic.
+ * JoranConfigurator class adds rules specific to logback-classic.
*
* @author Ceki Gülcü
*/
@@ -40,54 +40,51 @@ public class JoranConfigurator extends JoranConfiguratorBase {
// parent rules already added
super.addInstanceRules(rs);
- rs.addRule(new Pattern("configuration"), new ConfigurationAction());
+ rs.addRule(new ElementSelector("configuration"), new ConfigurationAction());
- rs.addRule(new Pattern("configuration/contextName"),
+ rs.addRule(new ElementSelector("configuration/contextName"),
new ContextNameAction());
- rs.addRule(new Pattern("configuration/contextListener"),
+ rs.addRule(new ElementSelector("configuration/contextListener"),
new LoggerContextListenerAction());
- rs.addRule(new Pattern("configuration/insertFromJNDI"),
+ rs.addRule(new ElementSelector("configuration/insertFromJNDI"),
new InsertFromJNDIAction());
- rs.addRule(new Pattern("configuration/evaluator"), new EvaluatorAction());
+ rs.addRule(new ElementSelector("configuration/evaluator"), new EvaluatorAction());
- rs.addRule(new Pattern("configuration/appender/sift"), new SiftAction());
- rs.addRule(new Pattern("configuration/appender/sift/*"), new NOPAction());
+ rs.addRule(new ElementSelector("configuration/appender/sift"), new SiftAction());
+ rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction());
- rs.addRule(new Pattern("configuration/logger"), new LoggerAction());
- rs.addRule(new Pattern("configuration/logger/level"), new LevelAction());
+ rs.addRule(new ElementSelector("configuration/logger"), new LoggerAction());
+ rs.addRule(new ElementSelector("configuration/logger/level"), new LevelAction());
- rs.addRule(new Pattern("configuration/root"), new RootLoggerAction());
- rs.addRule(new Pattern("configuration/root/level"), new LevelAction());
- rs.addRule(new Pattern("configuration/logger/appender-ref"),
+ rs.addRule(new ElementSelector("configuration/root"), new RootLoggerAction());
+ rs.addRule(new ElementSelector("configuration/root/level"), new LevelAction());
+ rs.addRule(new ElementSelector("configuration/logger/appender-ref"),
new AppenderRefAction());
- rs.addRule(new Pattern("configuration/root/appender-ref"),
+ rs.addRule(new ElementSelector("configuration/root/appender-ref"),
new AppenderRefAction());
// add if-then-else support
- rs.addRule(new Pattern("*/if"), new IfAction());
- rs.addRule(new Pattern("*/if/then"), new ThenAction());
- rs.addRule(new Pattern("*/if/then/*"), new NOPAction());
- rs.addRule(new Pattern("*/if/else"), new ElseAction());
- rs.addRule(new Pattern("*/if/else/*"), new NOPAction());
+ rs.addRule(new ElementSelector("*/if"), new IfAction());
+ rs.addRule(new ElementSelector("*/if/then"), new ThenAction());
+ rs.addRule(new ElementSelector("*/if/then/*"), new NOPAction());
+ rs.addRule(new ElementSelector("*/if/else"), new ElseAction());
+ rs.addRule(new ElementSelector("*/if/else/*"), new NOPAction());
// add jmxConfigurator only if we have JMX available.
// If running under JDK 1.4 (retrotranslateed logback) then we
// might not have JMX.
if (PlatformInfo.hasJMXObjectName()) {
- rs.addRule(new Pattern("configuration/jmxConfigurator"),
+ rs.addRule(new ElementSelector("configuration/jmxConfigurator"),
new JMXConfiguratorAction());
}
- rs.addRule(new Pattern("configuration/include"), new IncludeAction());
+ rs.addRule(new ElementSelector("configuration/include"), new IncludeAction());
- rs.addRule(new Pattern("configuration/consolePlugin"),
+ rs.addRule(new ElementSelector("configuration/consolePlugin"),
new ConsolePluginAction());
- rs.addRule(new Pattern("configuration/server"),
- new ServerAction());
-
- rs.addRule(new Pattern("configuration/remote"),
- new SocketRemoteAction());
-
+ rs.addRule(new ElementSelector("configuration/receiver"),
+ new ReceiverAction());
+
}
@Override
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConfigurationAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConfigurationAction.java
index 1a7dfb62c6924ca5d6bb13332644dd9bcac098ab..840c48e2153e34838109368bc1c9dc90a83f2933 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConfigurationAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConfigurationAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -39,7 +39,7 @@ public class ConfigurationAction extends Action {
// See LOGBACK-527 (the system property is looked up first. Thus, it overrides
// the equivalent property in the config file. This reversal of scope priority is justified
// by the use case: the admin trying to chase rogue config file
- String debugAttrib = System.getProperty(DEBUG_SYSTEM_PROPERTY_KEY);
+ String debugAttrib = getSystemProperty(DEBUG_SYSTEM_PROPERTY_KEY);
if (debugAttrib == null) {
debugAttrib = ic.subst(attributes.getValue(INTERNAL_DEBUG_ATTR));
}
@@ -66,6 +66,18 @@ public class ConfigurationAction extends Action {
ic.pushObject(getContext());
}
+ String getSystemProperty(String name) {
+ /*
+ * LOGBACK-743: accessing a system property in the presence of a
+ * SecurityManager (e.g. applet sandbox) can result in a SecurityException.
+ */
+ try {
+ return System.getProperty(name);
+ } catch (SecurityException ex) {
+ return null;
+ }
+ }
+
void processScanAttrib(InterpretationContext ic, Attributes attributes) {
String scanAttrib = ic.subst(attributes.getValue(SCAN_ATTR));
if (!OptionHelper.isEmpty(scanAttrib)
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConsolePluginAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConsolePluginAction.java
index 38b7e43436adfcf9378a13d059b107c9ad3defcb..67c365b55ccb1c90d89bdd57cddaf8db6bb96e39 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConsolePluginAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConsolePluginAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ContextNameAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ContextNameAction.java
index ee6c5a807d93f76ac1481f0aa23843910772151b..d06f2caa11cedaa49a4c866a918d7428336f04c5 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ContextNameAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ContextNameAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/EvaluatorAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/EvaluatorAction.java
index d0be728f38c4ac9cb0230bdd696f227c49ceb203..f2fcc5c01ec407f1b8bd26ac993396acefb587c1 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/EvaluatorAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/EvaluatorAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/InsertFromJNDIAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/InsertFromJNDIAction.java
index db76891772afe1f4e584dc5e4aeec3adcced95f1..502976564207acd66bc417a61ec99a65710eb9e2 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/InsertFromJNDIAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/InsertFromJNDIAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/JMXConfiguratorAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/JMXConfiguratorAction.java
index 31a85d836e69060b8b8c50b0c863112256405f64..61a4f6be9b7b6589ebb837558b28922153d92391 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/JMXConfiguratorAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/JMXConfiguratorAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LevelAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LevelAction.java
index 7ee3796923eccce424532f38ea9c27cb2e3377dd..bbdfe2696760984b39fc5190fe9403726fc69b4a 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LevelAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LevelAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerAction.java
index 85d0aab753176123801b8ffd99bdc7213903df9a..665846614a49b119af222958c2747168aca3dab2 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerContextListenerAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerContextListenerAction.java
index 9a5d8e9f18d87091ec9b4bc170c6fa209ad46bb5..8da3efa6627eb14ce55060165c7d2c69bb69a2d4 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerContextListenerAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/LoggerContextListenerAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/SocketRemoteAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ReceiverAction.java
similarity index 61%
rename from logback-classic/src/main/java/ch/qos/logback/classic/joran/action/SocketRemoteAction.java
rename to logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ReceiverAction.java
index cc087be9931bd71e367b8cd4814dac1ca114aef2..7a79afde94c497e12e10a80a7a081723581fdf47 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/SocketRemoteAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ReceiverAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -15,42 +15,47 @@ package ch.qos.logback.classic.joran.action;
import org.xml.sax.Attributes;
-import ch.qos.logback.classic.net.SocketRemote;
+import ch.qos.logback.classic.net.ReceiverBase;
+import ch.qos.logback.classic.net.SocketReceiver;
import ch.qos.logback.core.joran.action.Action;
import ch.qos.logback.core.joran.spi.ActionException;
import ch.qos.logback.core.joran.spi.InterpretationContext;
import ch.qos.logback.core.util.OptionHelper;
/**
- * A Joran {@link Action} for a {@link SocketRemote} configuration.
+ * A Joran {@link Action} for a {@link SocketReceiver} configuration.
*
* @author Carl Harris
*/
-public class SocketRemoteAction extends Action {
+public class ReceiverAction extends Action {
- private SocketRemote remote;
+ private ReceiverBase receiver;
private boolean inError;
@Override
public void begin(InterpretationContext ic, String name,
Attributes attributes) throws ActionException {
+
String className = attributes.getValue(CLASS_ATTRIBUTE);
if (OptionHelper.isEmpty(className)) {
- className = SocketRemote.class.getCanonicalName();
+ addError("Missing class name for receiver. Near [" + name
+ + "] line " + getLineNumber(ic));
+ inError = true;
+ return;
}
try {
- addInfo("About to instantiate remote of type [" + className + "]");
-
- remote = (SocketRemote) OptionHelper.instantiateByClassName(
- className, SocketRemote.class, context);
- remote.setContext(context);
+ addInfo("About to instantiate receiver of type [" + className + "]");
- ic.pushObject(remote);
+ receiver = (ReceiverBase) OptionHelper.instantiateByClassName(
+ className, ReceiverBase.class, context);
+ receiver.setContext(context);
+
+ ic.pushObject(receiver);
}
catch (Exception ex) {
inError = true;
- addError("Could not create a remote of type [" + className + "].", ex);
+ addError("Could not create a receiver of type [" + className + "].", ex);
throw new ActionException(ex);
}
}
@@ -61,10 +66,11 @@ public class SocketRemoteAction extends Action {
if (inError) return;
- remote.start();
-
+ ic.getContext().register(receiver);
+ receiver.start();
+
Object o = ic.peekObject();
- if (o != remote) {
+ if (o != receiver) {
addWarn("The object at the of the stack is not the remote " +
"pushed earlier.");
} else {
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/RootLoggerAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/RootLoggerAction.java
index fc4c4817e5a5ad0106dce5e15aa3e64faaf3148d..a52eb06c09928e34a9db9ce76041003188fd5e23 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/RootLoggerAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/RootLoggerAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ServerAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ServerAction.java
deleted file mode 100644
index 5d0c4b11bf833c2eb51c048d17687522bd266f6d..0000000000000000000000000000000000000000
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ServerAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, 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.classic.joran.action;
-
-import org.xml.sax.Attributes;
-
-import ch.qos.logback.classic.net.server.SocketServer;
-import ch.qos.logback.core.joran.action.Action;
-import ch.qos.logback.core.joran.spi.ActionException;
-import ch.qos.logback.core.joran.spi.InterpretationContext;
-import ch.qos.logback.core.util.OptionHelper;
-
-/**
- * A Joran {@link Action} for a server configuration.
- *
- * @author Carl Harris
- */
-public class ServerAction extends Action {
-
- private SocketServer server;
- private boolean inError;
-
- @Override
- public void begin(InterpretationContext ic, String name,
- Attributes attributes) throws ActionException {
- String className = attributes.getValue(CLASS_ATTRIBUTE);
- if (OptionHelper.isEmpty(className)) {
- className = SocketServer.class.getCanonicalName();
- }
- try {
- addInfo("About to instantiate server of type [" + className + "]");
-
- server = (SocketServer) OptionHelper.instantiateByClassName(className,
- SocketServer.class, context);
- server.setContext(context);
- ic.pushObject(server);
- }
- catch (Exception ex) {
- inError = true;
- addError("Could not create a server of type [" + className + "].", ex);
- throw new ActionException(ex);
- }
- }
-
- @Override
- public void end(InterpretationContext ic, String name)
- throws ActionException {
-
- if (inError) return;
-
- server.start();
-
- Object o = ic.peekObject();
- if (o != server) {
- addWarn("The object at the of the stack is not the server " +
- "pushed earlier.");
- } else {
- ic.popObject();
- }
- }
-
-}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/jul/JULHelper.java b/logback-classic/src/main/java/ch/qos/logback/classic/jul/JULHelper.java
index 0ee1afb6048572423a6c91b7301ecc1d3f2a9f7e..121cd0a217094c87a420cf5806c1dcd55a42fa9a 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/jul/JULHelper.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/jul/JULHelper.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/jul/LevelChangePropagator.java b/logback-classic/src/main/java/ch/qos/logback/classic/jul/LevelChangePropagator.java
index 2c90cec1c08746237958b9e01902fa9a4b97a2a5..a7fa5a22d59b52f39544fdd8457b3698f66de12f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/jul/LevelChangePropagator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/jul/LevelChangePropagator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java b/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java
index a5c9def061b8ddad2fcae320a2ed5fe5cf4db432..6516c80d9478ab2f084c2d09982073a8588f95e6 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/log4j/XMLLayout.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java
index 90de734eb8df9b373782cb655207bd7b4336f13e..05f8510ad57006c6221b2baa9387a1e1d084de4d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueSink.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueSink.java
index fcf84a6fa219cc96daf82f5b0f815b3af963d2f6..0e951f725dff422d6bfc65b0935a5ebac1aa1240 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueSink.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueSink.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java
index c88e6963e291cb2568c5b985693c962860deb21d..1e3f46113d39d05127235fc46296ef97bac7b5e2 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicSink.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicSink.java
index 7556fb5b2530ed9d11a780988006c080cb0870e4..88bee446c30f36e338368cc9129b1f5fab9af50f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicSink.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicSink.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/LoggingEventPreSerializationTransformer.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/LoggingEventPreSerializationTransformer.java
index 635102212a178a659fd0c67ff774c7bed4269bf2..68727fa63fe691b27a6b926119cfba4f0de90922 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/LoggingEventPreSerializationTransformer.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/LoggingEventPreSerializationTransformer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/ReceiverBase.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/ReceiverBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..e6c0ded3a824b5e1c3402d2c10f90b66a8f5f070
--- /dev/null
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/ReceiverBase.java
@@ -0,0 +1,87 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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.classic.net;
+
+import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.spi.LifeCycle;
+
+/**
+ * An abstract base for components that receive logging events from a remote
+ * peer and log according to local policy
+ *
+ * @author Carl Harris
+ */
+public abstract class ReceiverBase extends ContextAwareBase
+ implements LifeCycle {
+
+ private boolean started;
+
+ /**
+ * {@inheritDoc}
+ */
+ public final void start() {
+ if (isStarted()) return;
+ if (getContext() == null) {
+ throw new IllegalStateException("context not set");
+ }
+ if (shouldStart()) {
+ getContext().getExecutorService().execute(getRunnableTask());
+ started = true;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public final void stop() {
+ if (!isStarted()) return;
+ try {
+ onStop();
+ }
+ catch (RuntimeException ex) {
+ addError("on stop: " + ex, ex);
+ }
+ started = false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public final boolean isStarted() {
+ return started;
+ }
+
+ /**
+ * Determines whether this receiver should start.
+ *
+ * Subclasses will implement this method to do any subclass-specific
+ * validation. The subclass's {@link #getRunnableTask()} method will be
+ * invoked (and the task returned will be submitted to the executor)
+ * if and only if this method returns {@code true}
+ * @return flag indicating whether this receiver should start
+ */
+ protected abstract boolean shouldStart();
+
+ /**
+ * Allows a subclass to participate in receiver shutdown.
+ */
+ protected abstract void onStop();
+
+ /**
+ * Provides the runnable task this receiver will execute.
+ * @return runnable task
+ */
+ protected abstract Runnable getRunnableTask();
+
+}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java
index d35bd51fccc38c80a23fad047fa63ccd9e3c5ec3..4192297a2cb1fe7479388be6b52c0de7adb0bef7 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SMTPAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -93,7 +93,7 @@ public class SMTPAppender extends SMTPAppenderBase {
}
}
- protected boolean isEventMarkedForBufferRemoval(ILoggingEvent eventObject) {
+ protected boolean eventMarksEndOfLife(ILoggingEvent eventObject) {
Marker marker = eventObject.getMarker();
if(marker == null)
return false;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketAppender.java
index 788d509ef694266071b7fd83fd4a55512110de08..dd26701636871f256c5b10bd05fd709b1e08e75e 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -16,7 +16,7 @@ package ch.qos.logback.classic.net;
import java.net.InetAddress;
import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.net.SSLSocketAppenderBase;
+import ch.qos.logback.core.net.AbstractSSLSocketAppender;
import ch.qos.logback.core.spi.PreSerializationTransformer;
/**
@@ -27,7 +27,7 @@ import ch.qos.logback.core.spi.PreSerializationTransformer;
*
* @author Carl Harris
*/
-public class SSLSocketAppender extends SSLSocketAppenderBase {
+public class SSLSocketAppender extends AbstractSSLSocketAppender {
private final PreSerializationTransformer pst =
new LoggingEventPreSerializationTransformer();
@@ -40,16 +40,17 @@ public class SSLSocketAppender extends SSLSocketAppenderBase {
/**
* Connects to remote server at address and port.
*/
+ @Deprecated
public SSLSocketAppender(String host, int port) {
- this(getAddressByName(host), port);
+ super(host, port);
}
/**
* Connects to remote server at address and port.
*/
+ @Deprecated
public SSLSocketAppender(InetAddress address, int port) {
- this.address = address;
- this.port = port;
+ super(address.getHostAddress(), port);
}
@Override
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketRemote.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketReceiver.java
similarity index 82%
rename from logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketRemote.java
rename to logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketReceiver.java
index e6cfc88b507336c1ab3e7ba11a4fdc0c88a8bbbe..913a194d685341ad148c293396fc0f29e6ac0eca 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketRemote.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketReceiver.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,29 +11,30 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.classic.net;
import javax.net.SocketFactory;
import javax.net.ssl.SSLContext;
import ch.qos.logback.core.net.ssl.ConfigurableSSLSocketFactory;
+import ch.qos.logback.core.net.ssl.SSLComponent;
import ch.qos.logback.core.net.ssl.SSLConfiguration;
import ch.qos.logback.core.net.ssl.SSLParametersConfiguration;
/**
- * A {@link SocketRemote} that supports SSL.
+ * A {@link SocketReceiver} that supports SSL.
*
* @author Carl Harris
*/
-public class SSLSocketRemote extends SocketRemote {
+public class SSLSocketReceiver extends SocketReceiver
+ implements SSLComponent {
private SSLConfiguration ssl;
private SocketFactory socketFactory;
/**
* Gets an {@link SocketFactory} that produces SSL sockets using an
- * {@link SSLContext} that is derived from the remote's configuration.
+ * {@link SSLContext} that is derived from the receiver's configuration.
* @return socket factory
*/
@Override
@@ -45,17 +46,18 @@ public class SSLSocketRemote extends SocketRemote {
* {@inheritDoc}
*/
@Override
- public void start() {
+ protected boolean shouldStart() {
try {
SSLContext sslContext = getSsl().createContext(this);
SSLParametersConfiguration parameters = getSsl().getParameters();
parameters.setContext(getContext());
socketFactory = new ConfigurableSSLSocketFactory(parameters,
sslContext.getSocketFactory());
- super.start();
+ return super.shouldStart();
}
catch (Exception ex) {
addError(ex.getMessage(), ex);
+ return false;
}
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSSLSocketServer.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSSLSocketServer.java
index 85056f765c87dcac422b87b77a26c59e4a4fa884..7dde76093fd67768c9296992f8412091211a7a56 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSSLSocketServer.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSSLSocketServer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSocketServer.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSocketServer.java
index fab43b3339c86f5e8ac2d9028e5ec10f84975e4f..ae832e412fbf22adecf8bf2e1038189283f6b4b9 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSocketServer.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSocketServer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAcceptor.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAcceptor.java
index c5d782f34cec1fefc060988bcfb11813c08f2a3b..87d4391427a76d7484daabd87f734e656cf008b6 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAcceptor.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAcceptor.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAppender.java
index 27eb4d3ea94dbe5b6b35fb24aa1392561e63f24a..3396c7013d5aa18879b84f53f99035d3166052bb 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -17,7 +17,7 @@ package ch.qos.logback.classic.net;
import java.net.InetAddress;
import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.net.SocketAppenderBase;
+import ch.qos.logback.core.net.AbstractSocketAppender;
import ch.qos.logback.core.spi.PreSerializationTransformer;
/**
@@ -31,31 +31,30 @@ import ch.qos.logback.core.spi.PreSerializationTransformer;
* @author Sébastien Pennec
*/
-public class SocketAppender extends SocketAppenderBase {
+public class SocketAppender extends AbstractSocketAppender {
- boolean includeCallerData = false;
-
- PreSerializationTransformer pst = new LoggingEventPreSerializationTransformer();
+ private static final PreSerializationTransformer pst =
+ new LoggingEventPreSerializationTransformer();
+ private boolean includeCallerData = false;
+
public SocketAppender() {
}
/**
- * Connects to remote server at address and port.
+ * Connects to remote server at host and port.
*/
- public SocketAppender(InetAddress address, int port) {
- this.address = address;
- this.remoteHost = address.getHostName();
- this.port = port;
+ @Deprecated
+ public SocketAppender(String host, int port) {
+ super(host, port);
}
/**
- * Connects to remote server at host and port.
+ * Connects to remote server at address and port.
*/
- public SocketAppender(String host, int port) {
- this.port = port;
- this.address = getAddressByName(host);
- this.remoteHost = host;
+ @Deprecated
+ public SocketAppender(InetAddress address, int port) {
+ super(address.getHostAddress(), port);
}
@Override
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketNode.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketNode.java
index ac6b510929a671483aa463fa76ce1670b31a12da..9356c26d27efc6a3afee0d28a317c6ec3f9e1d70 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketNode.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketNode.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketReceiver.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketReceiver.java
new file mode 100644
index 0000000000000000000000000000000000000000..708af5a0dea28226c1201bc09f7da03cb6c0bd13
--- /dev/null
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketReceiver.java
@@ -0,0 +1,225 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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.classic.net;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.net.ConnectException;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
+
+import javax.net.SocketFactory;
+
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.net.DefaultSocketConnector;
+import ch.qos.logback.core.net.AbstractSocketAppender;
+import ch.qos.logback.core.net.SocketConnector;
+import ch.qos.logback.core.util.CloseUtil;
+
+/**
+ * A component that receives serialized {@link ILoggingEvent} objects from a
+ * remote appender over a {@link Socket}.
+ *
+ * @author Carl Harris
+ */
+public class SocketReceiver extends ReceiverBase
+ implements Runnable, SocketConnector.ExceptionHandler {
+
+ private static final int DEFAULT_ACCEPT_CONNECTION_DELAY = 5000;
+
+ private String remoteHost;
+ private InetAddress address;
+ private int port;
+ private int reconnectionDelay;
+ private int acceptConnectionTimeout = DEFAULT_ACCEPT_CONNECTION_DELAY;
+
+ private String receiverId;
+ private volatile Socket socket;
+ private Future connectorTask;
+
+ /**
+ * {@inheritDoc}
+ */
+ protected boolean shouldStart() {
+ int errorCount = 0;
+ if (port == 0) {
+ errorCount++;
+ addError("No port was configured for receiver. "
+ + "For more information, please visit http://logback.qos.ch/codes.html#receiver_no_port");
+ }
+
+ if (remoteHost == null) {
+ errorCount++;
+ addError("No host name or address was configured for receiver. "
+ + "For more information, please visit http://logback.qos.ch/codes.html#receiver_no_host");
+ }
+
+ if (reconnectionDelay == 0) {
+ reconnectionDelay = AbstractSocketAppender.DEFAULT_RECONNECTION_DELAY;
+ }
+
+ if (errorCount == 0) {
+ try {
+ address = InetAddress.getByName(remoteHost);
+ } catch (UnknownHostException ex) {
+ addError("unknown host: " + remoteHost);
+ errorCount++;
+ }
+ }
+
+ if (errorCount == 0) {
+ receiverId = "receiver " + remoteHost + ":" + port + ": ";
+ }
+
+ return errorCount == 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void onStop() {
+ if (socket != null) {
+ CloseUtil.closeQuietly(socket);
+ }
+ }
+
+ @Override
+ protected Runnable getRunnableTask() {
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run() {
+ try {
+ LoggerContext lc = (LoggerContext) getContext();
+ while (!Thread.currentThread().isInterrupted()) {
+ SocketConnector connector = createConnector(address, port, 0,
+ reconnectionDelay);
+ connectorTask = activateConnector(connector);
+ if (connectorTask == null)
+ break;
+ socket = waitForConnectorToReturnASocket();
+ if (socket == null)
+ break;
+ dispatchEvents(lc);
+ }
+ } catch (InterruptedException ex) {
+ assert true; // ok... we'll exit now
+ }
+ addInfo("shutting down");
+ }
+
+ private SocketConnector createConnector(InetAddress address, int port,
+ int initialDelay, int retryDelay) {
+ SocketConnector connector = newConnector(address, port, initialDelay,
+ retryDelay);
+ connector.setExceptionHandler(this);
+ connector.setSocketFactory(getSocketFactory());
+ return connector;
+ }
+
+
+ private Future activateConnector(SocketConnector connector) {
+ try {
+ return getContext().getExecutorService().submit(connector);
+ } catch (RejectedExecutionException ex) {
+ return null;
+ }
+ }
+
+ private Socket waitForConnectorToReturnASocket() throws InterruptedException {
+ try {
+ Socket s = connectorTask.get();
+ connectorTask = null;
+ return s;
+ } catch (ExecutionException e) {
+ return null;
+ }
+ }
+
+ private void dispatchEvents(LoggerContext lc) {
+ try {
+ socket.setSoTimeout(acceptConnectionTimeout);
+ ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+ socket.setSoTimeout(0);
+ addInfo(receiverId + "connection established");
+ while (true) {
+ ILoggingEvent event = (ILoggingEvent) ois.readObject();
+ Logger remoteLogger = lc.getLogger(event.getLoggerName());
+ if (remoteLogger.isEnabledFor(event.getLevel())) {
+ remoteLogger.callAppenders(event);
+ }
+ }
+ } catch (EOFException ex) {
+ addInfo(receiverId + "end-of-stream detected");
+ } catch (IOException ex) {
+ addInfo(receiverId + "connection failed: " + ex);
+ } catch (ClassNotFoundException ex) {
+ addInfo(receiverId + "unknown event class: " + ex);
+ } finally {
+ CloseUtil.closeQuietly(socket);
+ socket = null;
+ addInfo(receiverId + "connection closed");
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void connectionFailed(SocketConnector connector, Exception ex) {
+ if (ex instanceof InterruptedException) {
+ addInfo("connector interrupted");
+ } else if (ex instanceof ConnectException) {
+ addInfo(receiverId + "connection refused");
+ } else {
+ addInfo(receiverId + ex);
+ }
+ }
+
+
+ protected SocketConnector newConnector(InetAddress address,
+ int port, int initialDelay, int retryDelay) {
+ return new DefaultSocketConnector(address, port, initialDelay, retryDelay);
+ }
+
+ protected SocketFactory getSocketFactory() {
+ return SocketFactory.getDefault();
+ }
+
+ public void setRemoteHost(String remoteHost) {
+ this.remoteHost = remoteHost;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void setReconnectionDelay(int reconnectionDelay) {
+ this.reconnectionDelay = reconnectionDelay;
+ }
+
+ public void setAcceptConnectionTimeout(int acceptConnectionTimeout) {
+ this.acceptConnectionTimeout = acceptConnectionTimeout;
+ }
+
+}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketRemote.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketRemote.java
deleted file mode 100644
index 525a795897f3aef89eaf78841fe40a9f51190ecb..0000000000000000000000000000000000000000
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketRemote.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, 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.classic.net;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.net.ConnectException;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.RejectedExecutionException;
-
-import javax.net.SocketFactory;
-
-import org.slf4j.ILoggerFactory;
-import org.slf4j.LoggerFactory;
-
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.net.SocketAppenderBase;
-import ch.qos.logback.core.net.SocketConnector;
-import ch.qos.logback.core.net.SocketConnectorBase;
-import ch.qos.logback.core.spi.ContextAwareBase;
-import ch.qos.logback.core.spi.LifeCycle;
-import ch.qos.logback.core.util.CloseUtil;
-
-/**
- * A component that receives serialized {@link ILoggingEvent} objects from a
- * remote appender over a {@link Socket}.
- *
- * @author Carl Harris
- */
-public class SocketRemote extends ContextAwareBase
- implements LifeCycle, SocketConnector.ExceptionHandler, Runnable {
-
- private static final int DEFAULT_ACCEPT_CONNECTION_DELAY = 5000;
-
- private String host;
- private InetAddress address;
- private int port;
- private int reconnectionDelay;
- private int acceptConnectionTimeout = DEFAULT_ACCEPT_CONNECTION_DELAY;
-
- private ExecutorService executor;
- private boolean started;
- private String remoteId;
- private volatile Socket socket;
-
- /**
- * {@inheritDoc}
- */
- public void start() {
- if (isStarted()) return;
-
- if (getContext() == null) {
- throw new IllegalStateException("context not set");
- }
-
- int errorCount = 0;
- if (port == 0) {
- errorCount++;
- addError("No port was configured for remote. "
- + "For more information, please visit http://logback.qos.ch/codes.html#receiver_no_port");
- }
-
- if (host == null) {
- errorCount++;
- addError("No host name or address was configured for remote. "
- + "For more information, please visit http://logback.qos.ch/codes.html#receiver_no_host");
- }
-
- if (reconnectionDelay == 0) {
- reconnectionDelay = SocketAppenderBase.DEFAULT_RECONNECTION_DELAY;
- }
-
- if (errorCount == 0) {
- try {
- address = InetAddress.getByName(host);
- }
- catch (UnknownHostException ex) {
- addError("unknown host: " + host);
- errorCount++;
- }
- }
-
- if (errorCount == 0) {
- remoteId = "remote " + host + ":" + port + ": ";
- executor = createExecutorService();
- executor.execute(this);
- started = true;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void stop() {
- if (!isStarted()) return;
- if (socket != null) {
- CloseUtil.closeQuietly(socket);
- }
- executor.shutdownNow();
- started = false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isStarted() {
- return started;
- }
-
- /**
- * {@inheritDoc}
- */
- public void run() {
- try {
- LoggerContext lc = awaitConfiguration();
- SocketConnector connector = createConnector(address, port, 0,
- reconnectionDelay);
- while (!executor.isShutdown() &&
- !Thread.currentThread().isInterrupted()) {
- try {
- executor.execute(connector);
- }
- catch (RejectedExecutionException ex) {
- // executor is shutting down...
- continue;
- }
- socket = connector.awaitConnection();
- dispatchEvents(lc);
- connector = createConnector(address, port, reconnectionDelay);
- }
- }
- catch (InterruptedException ex) {
- assert true; // ok... we'll exit now
- }
- addInfo("shutting down");
- }
-
- private LoggerContext awaitConfiguration() throws InterruptedException {
- ILoggerFactory factory = LoggerFactory.getILoggerFactory();
- while (!(factory instanceof LoggerContext)
- && !Thread.currentThread().isInterrupted()) {
- Thread.sleep(500);
- factory = LoggerFactory.getILoggerFactory();
- }
- return (LoggerContext) factory;
- }
-
- private void dispatchEvents(LoggerContext lc) {
- try {
- socket.setSoTimeout(acceptConnectionTimeout);
- ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
- socket.setSoTimeout(0);
- addInfo(remoteId + "connection established");
- while (true) {
- ILoggingEvent event = (ILoggingEvent) ois.readObject();
- Logger remoteLogger = lc.getLogger(event.getLoggerName());
- if (remoteLogger.isEnabledFor(event.getLevel())) {
- remoteLogger.callAppenders(event);
- }
- }
- }
- catch (EOFException ex) {
- addInfo(remoteId + "end-of-stream detected");
- }
- catch (IOException ex) {
- addInfo(remoteId + "connection failed: " + ex);
- }
- catch (ClassNotFoundException ex) {
- addInfo(remoteId + "unknown event class: " + ex);
- }
- finally {
- CloseUtil.closeQuietly(socket);
- socket = null;
- addInfo(remoteId + "connection closed");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void connectionFailed(SocketConnector connector, Exception ex) {
- if (ex instanceof InterruptedException) {
- addInfo("connector interrupted");
- }
- else if (ex instanceof ConnectException) {
- addInfo(remoteId + "connection refused");
- }
- else {
- addInfo(remoteId + ex);
- }
- }
-
- private SocketConnector createConnector(InetAddress address, int port,
- int delay) {
- return createConnector(address, port, delay, delay);
- }
-
- private SocketConnector createConnector(InetAddress address, int port,
- int initialDelay, int retryDelay) {
- SocketConnector connector = newConnector(address, port, initialDelay,
- retryDelay);
- connector.setExceptionHandler(this);
- connector.setSocketFactory(getSocketFactory());
- return connector;
- }
-
- protected SocketConnector newConnector(InetAddress address,
- int port, int initialDelay, int retryDelay) {
- return new SocketConnectorBase(address, port, initialDelay, retryDelay);
- }
-
- protected SocketFactory getSocketFactory() {
- return SocketFactory.getDefault();
- }
-
- protected ExecutorService createExecutorService() {
- return Executors.newCachedThreadPool();
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public void setRemoteHost(String host) {
- setHost(host);
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public void setReconnectionDelay(int reconnectionDelay) {
- this.reconnectionDelay = reconnectionDelay;
- }
-
- public void setAcceptConnectionTimeout(int acceptConnectionTimeout) {
- this.acceptConnectionTimeout = acceptConnectionTimeout;
- }
-
-}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
index ebc67d5ccf05ee56a1775561d946410985af06d6..657574758f4f991d60489dee8f04c9c4253bc44d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderClient.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderClient.java
index e49d0b943fd156f0be334dab9aaffd50042d6f0e..3e93404b5a41cf22a488ed19752e5f1737ca5174 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderClient.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderClient.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderServerListener.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderServerListener.java
index e71d1356e77cadcf247dc99bb38f0bbfef9cb566..2eed08ec8629c5bc64fa8e29da64b1a2ba8ec14f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderServerListener.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderServerListener.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,7 +11,6 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.classic.net.server;
import java.io.IOException;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderServerRunner.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderServerRunner.java
index 99ed788363960923b3bcc411e4864a10faccc40c..a0ad2d745a25a9bd3b5d0c8a23726b1763c68979 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderServerRunner.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderServerRunner.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,7 +11,6 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.classic.net.server;
import java.util.concurrent.Executor;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClient.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClient.java
index 6d8d40951923c37cc15b64461111c8d08dbdc8d2..2a96018eb34b6d65ea09a31e565b3a820c3ecb93 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClient.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClient.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLServerSocketAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLServerSocketAppender.java
index 03c3689aa58980e9c78f015ca253586298a99147..dcb2c03cc31539d907893541c993419f98536932 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLServerSocketAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLServerSocketAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,7 +11,6 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.classic.net.server;
import ch.qos.logback.classic.net.LoggingEventPreSerializationTransformer;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLSocketServer.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLServerSocketReceiver.java
similarity index 87%
rename from logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLSocketServer.java
rename to logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLServerSocketReceiver.java
index 05af69688cfdee553779c6d9672e071750d00344..b4e0932eeb92c723fcd24bdb592fdeba8bf717db 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLSocketServer.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SSLServerSocketReceiver.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -17,15 +17,17 @@ import javax.net.ServerSocketFactory;
import javax.net.ssl.SSLContext;
import ch.qos.logback.core.net.ssl.ConfigurableSSLServerSocketFactory;
+import ch.qos.logback.core.net.ssl.SSLComponent;
import ch.qos.logback.core.net.ssl.SSLConfiguration;
import ch.qos.logback.core.net.ssl.SSLParametersConfiguration;
/**
- * A {@link SocketServer} that supports SSL.
+ * A {@link ServerSocketReceiver} that supports SSL.
*
* @author Carl Harris
*/
-public class SSLSocketServer extends SocketServer {
+public class SSLServerSocketReceiver extends ServerSocketReceiver
+ implements SSLComponent {
private SSLConfiguration ssl;
private ServerSocketFactory socketFactory;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/ServerSocketAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/ServerSocketAppender.java
index 272b3cf230f9643a0b8a63c97fbe989fdd5a1e80..b08d836efcfe5b6904791a1aa0a659c7683a1a0d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/ServerSocketAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/ServerSocketAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,12 +11,11 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.classic.net.server;
import ch.qos.logback.classic.net.LoggingEventPreSerializationTransformer;
import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.net.server.ServerSocketAppenderBase;
+import ch.qos.logback.core.net.server.AbstractServerSocketAppender;
import ch.qos.logback.core.spi.PreSerializationTransformer;
/**
@@ -27,7 +26,7 @@ import ch.qos.logback.core.spi.PreSerializationTransformer;
* @author Carl Harris
*/
public class ServerSocketAppender
- extends ServerSocketAppenderBase {
+ extends AbstractServerSocketAppender {
private static final PreSerializationTransformer pst =
new LoggingEventPreSerializationTransformer();
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SocketServer.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/ServerSocketReceiver.java
similarity index 67%
rename from logback-classic/src/main/java/ch/qos/logback/classic/net/server/SocketServer.java
rename to logback-classic/src/main/java/ch/qos/logback/classic/net/server/ServerSocketReceiver.java
index ee958793f36f5eae1c2f25e0a082eda859983d55..be0b8c11ff5edb922781391c8f04029a998745e5 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SocketServer.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/ServerSocketReceiver.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -18,54 +18,54 @@ import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.UnknownHostException;
import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
import javax.net.ServerSocketFactory;
-import ch.qos.logback.core.net.SocketAppenderBase;
+import ch.qos.logback.classic.net.ReceiverBase;
+import ch.qos.logback.core.net.AbstractSocketAppender;
import ch.qos.logback.core.net.server.ServerListener;
import ch.qos.logback.core.net.server.ServerRunner;
-import ch.qos.logback.core.net.server.ThreadPoolFactoryBean;
-import ch.qos.logback.core.spi.ContextAwareBase;
-import ch.qos.logback.core.spi.LifeCycle;
+import ch.qos.logback.core.util.CloseUtil;
/**
* A logging socket server that is configurable using Joran.
*
* @author Carl Harris
*/
-public class SocketServer extends ContextAwareBase implements LifeCycle {
+public class ServerSocketReceiver extends ReceiverBase {
/**
* Default {@link ServerSocket} backlog
*/
public static final int DEFAULT_BACKLOG = 50;
- private int port = SocketAppenderBase.DEFAULT_PORT;
+ private int port = AbstractSocketAppender.DEFAULT_PORT;
private int backlog = DEFAULT_BACKLOG;
private String address;
- private ThreadPoolFactoryBean threadPool;
+ private ServerSocket serverSocket;
private ServerRunner runner;
- private ExecutorService executor;
/**
* Starts the server.
*/
- public final void start() {
- if (isStarted()) return;
+ protected boolean shouldStart() {
try {
- ServerSocket socket = getServerSocketFactory().createServerSocket(
+ ServerSocket serverSocket = getServerSocketFactory().createServerSocket(
getPort(), getBacklog(), getInetAddress());
- ServerListener listener = createServerListener(socket);
- executor = getThreadPool().createExecutor();
- runner = createServerRunner(listener, executor);
+
+ ServerListener listener =
+ createServerListener(serverSocket);
+
+ runner = createServerRunner(listener, getContext().getExecutorService());
runner.setContext(getContext());
- runner.start();
+ return true;
}
catch (Exception ex) {
addError("server startup error: " + ex, ex);
+ CloseUtil.closeQuietly(serverSocket);
+ return false;
}
}
@@ -80,28 +80,24 @@ public class SocketServer extends ContextAwareBase implements LifeCycle {
return new RemoteAppenderServerRunner(listener, executor);
}
+ @Override
+ protected Runnable getRunnableTask() {
+ return runner;
+ }
+
/**
- * Stops the server.
+ * {@inheritDoc}
*/
- public final void stop() {
- if (!isStarted()) return;
+ protected void onStop() {
try {
+ if (runner == null) return;
runner.stop();
- executor.shutdownNow();
}
catch (IOException ex) {
addError("server shutdown error: " + ex, ex);
}
}
- /**
- * Gets a flag indicating whether the server is running.
- * @return flag state
- */
- public final boolean isStarted() {
- return runner != null && runner.isStarted();
- }
-
/**
* Gets the server socket factory.
*
@@ -147,7 +143,7 @@ public class SocketServer extends ContextAwareBase implements LifeCycle {
* @return queue depth
* @see java.net.ServerSocket
*/
- public Integer getBacklog() {
+ public int getBacklog() {
return backlog;
}
@@ -159,7 +155,7 @@ public class SocketServer extends ContextAwareBase implements LifeCycle {
* @param backlog the queue depth to set
* @see java.net.ServerSocket
*/
- public void setBacklog(Integer backlog) {
+ public void setBacklog(int backlog) {
this.backlog = backlog;
}
@@ -179,24 +175,4 @@ public class SocketServer extends ContextAwareBase implements LifeCycle {
this.address = address;
}
- /**
- * Gets the server's thread pool configuration.
- * @return thread pool configuration; if no thread pool configuration was
- * provided, a default configuration is returned
- */
- public ThreadPoolFactoryBean getThreadPool() {
- if (threadPool == null) {
- return new ThreadPoolFactoryBean();
- }
- return threadPool;
- }
-
- /**
- * Sets the server's thread pool configuration.
- * @param threadPool the configuration to set
- */
- public void setThreadPool(ThreadPoolFactoryBean threadPool) {
- this.threadPool = threadPool;
- }
-
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SocketServerNestedComponentRegistryRules.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SocketServerNestedComponentRegistryRules.java
deleted file mode 100644
index 148789b570a5350fa76eafe931ccce048622d3d3..0000000000000000000000000000000000000000
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/server/SocketServerNestedComponentRegistryRules.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, 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.classic.net.server;
-
-import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
-import ch.qos.logback.core.net.server.ThreadPoolFactoryBean;
-import ch.qos.logback.core.net.ssl.SSLConfiguration;
-
-/**
- * Nested component registry rules for {@link SocketServer}.
- *
- * @author Carl Harris
- */
-public class SocketServerNestedComponentRegistryRules {
-
- public static void addDefaultNestedComponentRegistryRules(
- DefaultNestedComponentRegistry registry) {
-
- registry.add(SocketServer.class, "threadPool",
- ThreadPoolFactoryBean.class);
- registry.add(SSLSocketServer.class, "ssl",
- SSLConfiguration.class);
- }
-
-}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Abbreviator.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Abbreviator.java
index b2a98926607c29c676120edd7abefd0b66f6980d..26b19a264bd091c7c4f7639dd9d9105f5634e972 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Abbreviator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Abbreviator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/CallerDataConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/CallerDataConverter.java
index 81bc67e8f9f17e405f7d677af39c4960fdb85517..46acd05b1c0beac1d1e8765096a42e936ff2d319 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/CallerDataConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/CallerDataConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassNameOnlyAbbreviator.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassNameOnlyAbbreviator.java
index 7a7fa97732c00454efa75a7605796dab66083f44..563f28886ea4018057e9e4383eeed2956dc17412 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassNameOnlyAbbreviator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassNameOnlyAbbreviator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassOfCallerConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassOfCallerConverter.java
index 2d9642371321a05405bcebd1de38ddab81c816d5..b38528a5bab3315cb39e7e4232f0b83c88d5901f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassOfCallerConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassOfCallerConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassicConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassicConverter.java
index ce7bb7efcdb5ca15ab9c67c437e557fa49eef6b8..e2dd5c1ec21007ed8c659a7bd4fadf485263b4fe 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassicConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ClassicConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ContextNameConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ContextNameConverter.java
index 6fd60e72622b07f45d3624c5192394b9608398f4..809e45e305e1fd3b83fc1c9c09288d6b0eb15b33 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ContextNameConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ContextNameConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
index b29a422a01bcb9bb9caf8ff556fa87165e5afc4b..081de3d396ba4e67a1c25a63f61417367a84fec0 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/EnsureExceptionHandling.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/EnsureExceptionHandling.java
index c946474ad24692f4e2f21cec4214c71dde5940c3..a174cadd82c7d1501d4eda43ae540e05e07b5111 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/EnsureExceptionHandling.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/EnsureExceptionHandling.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverter.java
index ad6b947b978619c36f76fb6a09c9ab7d0f329667..d3f9984958137c52ec84f361d3d65dba6b0ef7d7 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/FileOfCallerConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/FileOfCallerConverter.java
index 5af9e9cad0761ba9e6b4316ed95c2a56c72f12b9..740e9f2667773f871d50f2b75dd8e0151947d7c1 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/FileOfCallerConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/FileOfCallerConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LevelConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LevelConverter.java
index 05101c325ddc83775ab39490e30da748284bf143..6a63bc63f574c2f70e2ce97d218fbd646cc0c943 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LevelConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LevelConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LineOfCallerConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LineOfCallerConverter.java
index 6de5d17ddccaec3276bfb124cd99cadce6cdfff8..8f40a620cbf85d70e3784afc9ab994413b8ba2c7 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LineOfCallerConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LineOfCallerConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LineSeparatorConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LineSeparatorConverter.java
index 1840cd7d594e78c4aeb12c6827a434698e2b00e6..139d963524f64deeaaad66808ca01ac4f6aa30bd 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LineSeparatorConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LineSeparatorConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LocalSequenceNumberConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LocalSequenceNumberConverter.java
new file mode 100644
index 0000000000000000000000000000000000000000..b4d5fe2ae2adf521911eec7f39a3e07d28f00051
--- /dev/null
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LocalSequenceNumberConverter.java
@@ -0,0 +1,36 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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.classic.pattern;
+
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * A converters based on a a locally incremented sequence number. The sequence number is
+ * initialized to the number of milliseconds elapsed since 1970-01-01 until this instance
+ * is initialized.
+ *
+ *
+ * EXPERIMENTAL This class is experimental and may be removed in the future.
+ *
+ */
+public class LocalSequenceNumberConverter extends ClassicConverter {
+
+ AtomicLong sequenceNumber = new AtomicLong(System.currentTimeMillis());
+
+ @Override
+ public String convert(ILoggingEvent event) {
+ return Long.toString(sequenceNumber.getAndIncrement());
+ }
+}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LoggerConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LoggerConverter.java
index 6d5b19b698382a8dce3b78dcfd009fb58b342837..2adc2abf16990ae33329aaca2a096285d7c1470b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LoggerConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/LoggerConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java
index e97ceb3b774c2c2f26b2b13f4b545b54f6fc4ac0..08b2b591be29b12466762e0ddea70cbbe8e0de3d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,20 +13,24 @@
*/
package ch.qos.logback.classic.pattern;
-import java.util.Iterator;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+
import java.util.Map;
-import java.util.Set;
-import ch.qos.logback.classic.spi.ILoggingEvent;
+import static ch.qos.logback.core.util.OptionHelper.extractDefaultReplacement;
public class MDCConverter extends ClassicConverter {
- String key;
- private static final String EMPTY_STRING = "";
+ private String key;
+ private String defaultValue = "";
@Override
public void start() {
- key = getFirstOption();
+ String[] keyInfo = extractDefaultReplacement(getFirstOption());
+ key = keyInfo[0];
+ if (keyInfo[1] != null) {
+ defaultValue = keyInfo[1];
+ }
super.start();
}
@@ -41,7 +45,7 @@ public class MDCConverter extends ClassicConverter {
Map mdcPropertyMap = event.getMDCPropertyMap();
if (mdcPropertyMap == null) {
- return EMPTY_STRING;
+ return defaultValue;
}
if (key == null) {
@@ -52,7 +56,7 @@ public class MDCConverter extends ClassicConverter {
if (value != null) {
return value;
} else {
- return EMPTY_STRING;
+ return defaultValue;
}
}
}
@@ -60,7 +64,6 @@ public class MDCConverter extends ClassicConverter {
/**
* if no key is specified, return all the values present in the MDC, in the format "k1=v1, k2=v2, ..."
*/
-
private String outputMDCForAllKeys(Map mdcPropertyMap) {
StringBuilder buf = new StringBuilder();
boolean first = true;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MarkerConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MarkerConverter.java
index ffe89045f7292ce926a0c130767d7ce0fe982b00..739e6c09c61c3683d72197e6d2eb6a2644689ed2 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MarkerConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MarkerConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MessageConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MessageConverter.java
index 77dac6eb75ebd4d0ff0a999c2d43336b79eb563e..b89e4f0ef88f73805756b6759d7d3e35e5524f25 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MessageConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MessageConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MethodOfCallerConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MethodOfCallerConverter.java
index 736c8fb43c5337056fa9dd8de0025db31b96b9cf..b40674b99de0ef1f2b9796d2cb1455042857cda2 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MethodOfCallerConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MethodOfCallerConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/NamedConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/NamedConverter.java
index e7f5140ab7c7303961568c7188f08a96a601ef23..bad8a1d07751feb1f250c51e6c1dff9ca8508d6d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/NamedConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/NamedConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/NopThrowableInformationConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/NopThrowableInformationConverter.java
index 23d62f5aa7e74c6db776ed0956f6b59b4ad1b10b..be8dadeff3013d7a89c81eadcc68cb0d53599bba 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/NopThrowableInformationConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/NopThrowableInformationConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/PropertyConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/PropertyConverter.java
index a38824b282b919e79d46c2d4e14fb327633a7276..f70b0984d8211402af6f99950eea62a2a4573dff 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/PropertyConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/PropertyConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RelativeTimeConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RelativeTimeConverter.java
index 2de704a01f7dc99d52286db9f37aeb6d5cc95e7d..ef43dc08402f31c9f67df0fec9b3ecca5d8c7c40 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RelativeTimeConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RelativeTimeConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java
index 804f6f96f1522251df01b85965545994b27ac6ae..cd8c29bb3f48e451f784d1231fc648e19c681031 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/SyslogStartConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/SyslogStartConverter.java
index 1b0ce8362cf588f2ba29b1bb58a7a401f266a6c1..479b6c1609f6e805ae41b973ee44b3440333debb 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/SyslogStartConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/SyslogStartConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/TargetLengthBasedClassNameAbbreviator.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/TargetLengthBasedClassNameAbbreviator.java
index b4a8dd8761fed4e33bb9f9d6b87d544a65e6f685..7a8ee244a03971dbbcce74a6f2c6c256ec2fb4eb 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/TargetLengthBasedClassNameAbbreviator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/TargetLengthBasedClassNameAbbreviator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThreadConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThreadConverter.java
index d95338a1f78235e9aa8ed46c2c9d67bb60cfa0e3..c852e85ce9fa1b5809d5587c31226e8d8c26f5fa 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThreadConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThreadConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableHandlingConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableHandlingConverter.java
index cd1aa42c1183c85f14d00cf32af688c835fad0cf..5642711742f12296612850dbe9e2d5de69c0e0d5 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableHandlingConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableHandlingConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
index d8decc33218697c943e0275466d49dc69c78f808..a981ebf1cc8cc38d999b281ba4d03f627690f71b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -51,11 +51,10 @@ public class ThrowableProxyConverter extends ThrowableHandlingConverter {
if ("full".equals(lengthStr)) {
lengthOption = Integer.MAX_VALUE;
} else if ("short".equals(lengthStr)) {
- lengthOption = 2;
+ lengthOption = 1;
} else {
try {
- // we add one because, printing starts at offset 1
- lengthOption = Integer.parseInt(lengthStr) + 1;
+ lengthOption = Integer.parseInt(lengthStr);
} catch (NumberFormatException nfe) {
addError("Could not parse [" + lengthStr + "] as an integer");
lengthOption = Integer.MAX_VALUE;
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Util.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Util.java
index 6d0953691261355bdb20232fb2f5a5817cf93efc..f391417c9c3ac66fd847284f992f35b72dcfd90d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Util.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Util.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/color/HighlightingCompositeConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/color/HighlightingCompositeConverter.java
index 73186f214fd1ee008c89efe48e3247f6779ed801..c5e333869df39f25afb05f450b3d895eaf0f30eb 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/color/HighlightingCompositeConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/color/HighlightingCompositeConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2012, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextJNDISelector.java b/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextJNDISelector.java
index 5274f2ad87eff1329cda68dcd93240f52523d75d..936feea90dd24c73e60867f2180f33fa3fd0c234 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextJNDISelector.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextJNDISelector.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextSelector.java b/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextSelector.java
index 41c419ce085a995b03f5ca1bc59f982326ab6a98..f5a8aa1588aad371b8ec8af4ba1aa42c9dc44948 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextSelector.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextSelector.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/selector/DefaultContextSelector.java b/logback-classic/src/main/java/ch/qos/logback/classic/selector/DefaultContextSelector.java
index ddc402356abbd5fabdecaa46d5c71dbd5d34bca1..ca3e4e73340d3717a4a9f637344318d40638b579 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/selector/DefaultContextSelector.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/selector/DefaultContextSelector.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java b/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java
index 37b5098e2ea602c7d1cfa822956a1ebf20070151..0c0a65677792d3b4c8bb7c3350944d5a6809649a 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -42,6 +42,10 @@ public class ContextDetachingSCL implements ServletContextListener {
System.out.println("About to detach context named " + loggerContextName);
ContextSelector selector = ContextSelectorStaticBinder.getSingleton().getContextSelector();
+ if(selector == null) {
+ System.out.println("Selector is null, cannot detach context. Skipping.");
+ return;
+ }
LoggerContext context = selector.detachLoggerContext(loggerContextName);
if (context != null) {
Logger logger = context.getLogger(Logger.ROOT_LOGGER_NAME);
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/LoggerContextFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/LoggerContextFilter.java
index 832b889f9ec2bee0315fa16b753074b49cf25ac8..85bc38ec5e4403366206b09d0228726041bf5012 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/LoggerContextFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/LoggerContextFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactoryUsingJoran.java
similarity index 65%
rename from logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java
rename to logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactoryUsingJoran.java
index ae019bedbe02c7b8a0454ce00694781c7bbee048..98de9ba2b5953056b429aabac72aa019310a7852 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactory.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/AppenderFactoryUsingJoran.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -14,23 +14,25 @@
package ch.qos.logback.classic.sift;
import java.util.List;
+import java.util.Map;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.joran.event.SaxEvent;
-import ch.qos.logback.core.sift.AppenderFactoryBase;
+import ch.qos.logback.core.sift.AbstractAppenderFactoryUsingJoran;
import ch.qos.logback.core.sift.SiftingJoranConfiguratorBase;
-public class AppenderFactory extends AppenderFactoryBase{
+/**
+ *
+ */
+public class AppenderFactoryUsingJoran extends AbstractAppenderFactoryUsingJoran {
+
- String key;
-
- AppenderFactory(List eventList, String key) {
- super(eventList);
- this.key = key;
+ AppenderFactoryUsingJoran(List eventList, String key, Map parentPropertyMap) {
+ super(eventList, key, parentPropertyMap);
}
public SiftingJoranConfiguratorBase getSiftingJoranConfigurator(String discriminatingValue) {
- return new SiftingJoranConfigurator(key, discriminatingValue);
+ return new SiftingJoranConfigurator(key, discriminatingValue, parentPropertyMap);
}
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/ContextBasedDiscriminator.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/ContextBasedDiscriminator.java
index 619fb3f7a4d9bb79cdd246a022dd5014c7ff8067..db13f31e7cf031a1e0936d2c5c3deb7947eac9d2 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/ContextBasedDiscriminator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/ContextBasedDiscriminator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -14,8 +14,7 @@
package ch.qos.logback.classic.sift;
import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.sift.Discriminator;
-import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.sift.AbstractDiscriminator;
/**
* This discriminator returns the value context to which this event is attached
@@ -27,12 +26,10 @@ import ch.qos.logback.core.spi.ContextAwareBase;
* @author Ceki Gülcü
*
*/
-public class ContextBasedDiscriminator extends ContextAwareBase implements
- Discriminator {
+public class ContextBasedDiscriminator extends AbstractDiscriminator {
private static final String KEY = "contextName";
private String defaultValue;
- private boolean started = false;
/**
* Return the name of the current context name as found in the logging event.
@@ -47,18 +44,6 @@ public class ContextBasedDiscriminator extends ContextAwareBase implements
}
}
- public boolean isStarted() {
- return started;
- }
-
- public void start() {
- started = true;
- }
-
- public void stop() {
- started = false;
- }
-
public String getKey() {
return KEY;
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/JNDIBasedContextDiscriminator.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/JNDIBasedContextDiscriminator.java
index 39375ca0a7c1e1d3481d9e91a12e10e336afa952..5c6bfb166b1865213900d3132cffdb5d1b5cf17e 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/JNDIBasedContextDiscriminator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/JNDIBasedContextDiscriminator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -17,8 +17,7 @@ import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.selector.ContextSelector;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.util.ContextSelectorStaticBinder;
-import ch.qos.logback.core.sift.Discriminator;
-import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.sift.AbstractDiscriminator;
/**
* This discriminator returns the value context as determined by JNDI. If the
@@ -30,12 +29,10 @@ import ch.qos.logback.core.spi.ContextAwareBase;
* @author Ceki Gülcü
*
*/
-public class JNDIBasedContextDiscriminator extends ContextAwareBase implements
- Discriminator {
+public class JNDIBasedContextDiscriminator extends AbstractDiscriminator {
private static final String KEY = "contextName";
private String defaultValue;
- private boolean started = false;
/**
* Return the name of the current context name as found in the logging event.
@@ -56,18 +53,6 @@ public class JNDIBasedContextDiscriminator extends ContextAwareBase implements
return lc.getName();
}
- public boolean isStarted() {
- return started;
- }
-
- public void start() {
- started = true;
- }
-
- public void stop() {
- started = false;
- }
-
public String getKey() {
return KEY;
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java
index 7e15f5bfa37b6b0e5bcf13c0dee9ced7d9258e82..65447afdbc2694d0beeeee539633fa608c9da64f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -14,8 +14,7 @@
package ch.qos.logback.classic.sift;
import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.sift.Discriminator;
-import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.sift.AbstractDiscriminator;
import ch.qos.logback.core.util.OptionHelper;
import java.util.Map;
@@ -28,12 +27,10 @@ import java.util.Map;
*
* @author Ceki Gülcü
*/
-public class MDCBasedDiscriminator extends ContextAwareBase implements
- Discriminator {
+public class MDCBasedDiscriminator extends AbstractDiscriminator {
private String key;
private String defaultValue;
- private boolean started = false;
/**
* Return the value associated with an MDC entry designated by the Key
@@ -54,10 +51,7 @@ public class MDCBasedDiscriminator extends ContextAwareBase implements
}
}
- public boolean isStarted() {
- return started;
- }
-
+ @Override
public void start() {
int errors = 0;
if (OptionHelper.isEmpty(key)) {
@@ -73,10 +67,6 @@ public class MDCBasedDiscriminator extends ContextAwareBase implements
}
}
- public void stop() {
- started = false;
- }
-
public String getKey() {
return key;
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftAction.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftAction.java
index e57f4b7940c4930767e86647e4a13855240e09fd..764722e63e2f12b7dc3d524a29239f3417aa82f1 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftAction.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -15,6 +15,7 @@ package ch.qos.logback.classic.sift;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.xml.sax.Attributes;
@@ -40,8 +41,9 @@ public class SiftAction extends Action implements InPlayListener {
Object o = ic.peekObject();
if (o instanceof SiftingAppender) {
SiftingAppender sa = (SiftingAppender) o;
- AppenderFactory appenderFactory = new AppenderFactory(seList, sa
- .getDiscriminatorKey());
+ Map propertyMap = ic.getCopyOfPropertyMap();
+ AppenderFactoryUsingJoran appenderFactory = new AppenderFactoryUsingJoran(seList, sa
+ .getDiscriminatorKey(), propertyMap);
sa.setAppenderFactory(appenderFactory);
}
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingAppender.java
index 98fcd63f0c99704a3ee717be3daee2e3a4233e9c..b5cf0e114059b0e0b590a06bfae2b41f80a91a48 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,10 +13,12 @@
*/
package ch.qos.logback.classic.sift;
+import ch.qos.logback.classic.ClassicConstants;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.joran.spi.DefaultClass;
import ch.qos.logback.core.sift.Discriminator;
import ch.qos.logback.core.sift.SiftingAppenderBase;
+import org.slf4j.Marker;
/**
* This appender can contains other appenders which it can build dynamically
@@ -42,4 +44,11 @@ public class SiftingAppender extends SiftingAppenderBase {
super.setDiscriminator(discriminator);
}
+ protected boolean eventMarksEndOfLife(ILoggingEvent event) {
+ Marker marker = event.getMarker();
+ if(marker == null)
+ return false;
+
+ return marker.contains(ClassicConstants.FINALIZE_SESSION_MARKER);
+ }
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingJoranConfigurator.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingJoranConfigurator.java
index 481cc1089842d3fe281ac4ca687253a03a44ba8b..367f380d313306ed55f88ce23bfb7f091ea8bbfe 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingJoranConfigurator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/SiftingJoranConfigurator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -23,28 +23,27 @@ 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.DefaultNestedComponentRegistry;
-import ch.qos.logback.core.joran.spi.Pattern;
+import ch.qos.logback.core.joran.spi.ElementPath;
+import ch.qos.logback.core.joran.spi.ElementSelector;
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;
+
+ SiftingJoranConfigurator(String key, String value, Map parentPropertyMap) {
+ super(key, value, parentPropertyMap);
}
@Override
- protected Pattern initialPattern() {
- return new Pattern("configuration");
+ protected ElementPath initialElementPath() {
+ return new ElementPath("configuration");
}
@Override
protected void addInstanceRules(RuleStore rs) {
- rs.addRule(new Pattern("configuration/appender"), new AppenderAction());
+ super.addInstanceRules(rs);
+ rs.addRule(new ElementSelector("configuration/appender"), new AppenderAction());
}
@@ -61,6 +60,7 @@ public class SiftingJoranConfigurator extends SiftingJoranConfiguratorBase propertiesMap = new HashMap();
+ propertiesMap.putAll(parentPropertyMap);
propertiesMap.put(key, value);
interpreter.setInterpretationContextPropertiesMap(propertiesMap);
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/CallerData.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/CallerData.java
index aac922652eea6a80da029db91a660d52d5ae4e44..bf9fa62265661c69d57ce8eb00f7724c46d87c22 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/CallerData.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/CallerData.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassPackagingData.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassPackagingData.java
index 7e447070c9742a2003d69ec746370a078e0f601f..eb712b7818d01b8c60d65da9835a2448e2e618dc 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassPackagingData.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ClassPackagingData.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/EventArgUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/EventArgUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..5b33c0d4b1f99dea591e30baa47580fb3cf34c77
--- /dev/null
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/EventArgUtil.java
@@ -0,0 +1,54 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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.classic.spi;
+
+public class EventArgUtil {
+
+
+ public static final Throwable extractThrowable(Object[] argArray) {
+ if (argArray == null || argArray.length == 0) {
+ return null;
+ }
+
+ final Object lastEntry = argArray[argArray.length - 1];
+ if (lastEntry instanceof Throwable) {
+ return (Throwable) lastEntry;
+ }
+ return null;
+ }
+
+ /**
+ * This method should be called only if {@link #successfulExtraction(Throwable)} returns true.
+ *
+ * @param argArray
+ * @return
+ */
+ public static Object[] trimmedCopy(Object[] argArray) {
+ if (argArray == null || argArray.length == 0) {
+ throw new IllegalStateException("non-sensical empty or null argument array");
+ }
+ final int trimemdLen = argArray.length - 1;
+ Object[] trimmed = new Object[trimemdLen];
+ System.arraycopy(argArray, 0, trimmed, 0, trimemdLen);
+ return trimmed;
+ }
+
+ public static Object[] arrangeArguments(Object[] argArray) {
+ return argArray;
+ }
+
+ public static boolean successfulExtraction(Throwable throwable) {
+ return throwable != null;
+ }
+}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java
index 1abeff744e2cd87295b4c19ad661902a8a81885c..cb97aab213fdc58d9fc14e29534a9bef9b551a7b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java
index 8e841c8f430c2f5d51be43c401a34d120b67695f..27573c5e65c8bdc0c5780569973929e8ea00a6b2 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerComparator.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerComparator.java
index a58a26dfbb25b56de6dc3e893fedf7e9f0ebf358..0f1b3fa2ece24a9cd92b078c6a2349b20c73e701 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerComparator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerComparator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAware.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAware.java
index ae9ad6fd78d73b0ddaf95cc2c9925f7373e7cb13..c4c289fe08919a1fe9ac03159a7c61106b6c5c19 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAware.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAware.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAwareBase.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAwareBase.java
index 30b27240ee57db7fed854b83f48f6095542b8eb4..a335a4428322d25c350d6e560004b1c9565f4ed0 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAwareBase.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAwareBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextListener.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextListener.java
index c210ad0acc842f8a23619c672f7daf815ec374c8..5a5279a26631fd6d3eba9eb5a32f8935d8fd48fe 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextListener.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextListener.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextVO.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextVO.java
index ebc4799ba5230c8685028badaa601abba6f44292..022b7892572041c94240877db8a4ed31c8b9ca07 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextVO.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextVO.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerRemoteView.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerRemoteView.java
index 45bef0e9110ea37077c9c824a9d0b253f0734035..7e264cc59887f8bd6bcaab536cc68e595460ce77 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerRemoteView.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerRemoteView.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
old mode 100644
new mode 100755
index 25fe3808658d10846090032deeee630c41af3b81..73ed8230529b08fcca7468ca151156a93d74253d
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -80,7 +80,7 @@ public class LoggingEvent implements ILoggingEvent {
// we gain significant space at serialization time by marking
// formattedMessage as transient and constructing it lazily in
// getFormattedMessage()
- private transient String formattedMessage;
+ transient String formattedMessage;
private transient Object[] argumentArray;
@@ -111,15 +111,10 @@ public class LoggingEvent implements ILoggingEvent {
this.level = level;
this.message = message;
+ this.argumentArray = argArray;
- FormattingTuple ft = MessageFormatter.arrayFormat(message, argArray);
- formattedMessage = ft.getMessage();
-
- if (throwable == null) {
- argumentArray = ft.getArgArray();
- throwable = ft.getThrowable();
- } else {
- this.argumentArray = argArray;
+ if(throwable == null) {
+ throwable = extractThrowableAnRearrangeArguments(argArray);
}
if (throwable != null) {
@@ -133,6 +128,14 @@ public class LoggingEvent implements ILoggingEvent {
timeStamp = System.currentTimeMillis();
}
+ private Throwable extractThrowableAnRearrangeArguments(Object[] argArray) {
+ Throwable extractedThrowable = EventArgUtil.extractThrowable(argArray);
+ if(EventArgUtil.successfulExtraction(extractedThrowable)) {
+ this.argumentArray = EventArgUtil.trimmedCopy(argArray);
+ }
+ return extractedThrowable;
+ }
+
public void setArgumentArray(Object[] argArray) {
if (this.argumentArray != null) {
throw new IllegalStateException("argArray has been already set");
@@ -286,8 +289,7 @@ public class LoggingEvent implements ILoggingEvent {
return loggerContextVO.getBirthTime();
}
- // computer formatted lazy as suggested in
- // http://jira.qos.ch/browse/LBCLASSIC-47
+ // lazy computation as suggested in LOGBACK-495
public String getFormattedMessage() {
if (formattedMessage != null) {
return formattedMessage;
@@ -353,7 +355,7 @@ public class LoggingEvent implements ILoggingEvent {
/**
* LoggerEventVO instances should be used for serialization. Use
- * {@link LoggingEventVO#build(LoggingEvent) build} method to create the LoggerEventVO instance.
+ * {@link LoggingEventVO#build(ILoggingEvent) build} method to create the LoggerEventVO instance.
*
* @since 1.0.11
*/
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEventVO.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEventVO.java
index 5e2ea32da26b2a91d76871116daddbceaacd5eec..f9a924635508cf881d8137d25783cb8da7cbf840 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEventVO.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEventVO.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java
index f9fff783827a597d2445ab5501e1170f9c4be84f..4b89ac8f255c4954ba6602747a17005f36251edb 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -14,6 +14,7 @@
package ch.qos.logback.classic.spi;
import java.net.URL;
+import java.security.CodeSource;
import java.util.HashMap;
import sun.reflect.Reflection;
@@ -162,15 +163,18 @@ public class PackagingDataCalculator {
try {
if (type != null) {
// file:/C:/java/maven-2.0.8/repo/com/icegreen/greenmail/1.3/greenmail-1.3.jar
- URL resource = type.getProtectionDomain().getCodeSource().getLocation();
- if (resource != null) {
- String locationStr = resource.toString();
- // now lets remove all but the file name
- String result = getCodeLocation(locationStr, '/');
- if (result != null) {
- return result;
+ CodeSource codeSource = type.getProtectionDomain().getCodeSource();
+ if (codeSource != null) {
+ URL resource = codeSource.getLocation();
+ if (resource != null) {
+ String locationStr = resource.toString();
+ // now lets remove all but the file name
+ String result = getCodeLocation(locationStr, '/');
+ if (result != null) {
+ return result;
+ }
+ return getCodeLocation(locationStr, '\\');
}
- return getCodeLocation(locationStr, '\\');
}
}
} catch (Exception e) {
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/PlatformInfo.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/PlatformInfo.java
index 25f8f16644ecd81200b19498be0a29d1b6f19e7c..4747d059c8c08169bc6c7e817cbf07efa798e301 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/PlatformInfo.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/PlatformInfo.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/STEUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/STEUtil.java
index 42d0a83b007475f0e8316a456b4d8359595ab9ed..438ef7e7914613f60fbc7c44cc035a4a00584930 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/STEUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/STEUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java
index b9476f772f92aa8cd86f37ddf1998b350e92a686..c3466db769d47d387ee0b9d6c57bdf292ded6790 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/StackTraceElementProxy.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
index edb0b9badc64f26b8d9aaed4d035691f30cfbb6a..d289b29239405d2bce2faa5b2b3ac778cda2443a 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
index 40950d77ded816438e1e651eb4b81c7d82c4ddcc..9f0d7f9656d4cfbc5515d3e3f94df78f442c66c0 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java
index 45b3f7dadf86c1c2ca68426bca323e906ab044dc..9b5fda5ae8c38ab55e2eac8971faea1f4bf9b497 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java
index df1de73fa10841a40c546bb386e3a46d89b459bd..f1837af0c161e8d430f8c4af75ff5e8bb607793e 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java
index a2c15fabd0d1c55d2d967aaea752868890b8c1a3..77c349f0bf11e4ef81c966b9dbcc705445aafccc 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DuplicateMessageFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DynamicThresholdFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DynamicThresholdFilter.java
index 9729d5f67de9c239ff2878491e9eecb5986fd8ec..f06c7a27aeeeb80b9ac0fc4f2f790a2435f16edc 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DynamicThresholdFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/DynamicThresholdFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java
index 46e74cd4dc50056224490783b85654eadbb090e2..d1923e6ed62e005598a471fb13a8ffa13ebea26a 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCFilter.java
index 5e00e1c38ac881e30093e1f32295dddcf429cc3b..7cfd922f9e4ce523d065d70a87a01d8a6d69be6b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCValueLevelPair.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCValueLevelPair.java
index bd9372047b451b457c117209103b7f60c5062abf..e227f0835d5f9c6b2cfb6247fa364ab364e9d8f6 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCValueLevelPair.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MDCValueLevelPair.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
index ca84d34e93a7d21999ba332c427942ec86c9bba5..c71cf3677c0cb3eecead36418d677f6273ef586b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MatchingFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MatchingFilter.java
index 806453939af9a96f9d43e505f4fd0fc462087782..7e7fa55a6dd0e26bbd9672e6e4cf7e065944e12b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MatchingFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MatchingFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
index 02af906378b5a033d908c4fca5a9a8723f469ad8..f8e0d29034949c7c901506c076e2655e4f3d3eb8 100755
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java
index e32c802702b456a41767b87e5318ae402f879f72..31d76a2fe5932b578e3c672cf9878bf32b54d957 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/TurboFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java
index a579ead4086353efeac34ba26d281ce5c61b35dc..502f6525090c186a4f8797cd7249aa748db0a263 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextSelectorStaticBinder.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextSelectorStaticBinder.java
index 5c1175783643b7da5668e2f44679fb7dfae12307..56a2aa630bb3047b0d0182cacf7eb88d6558afef 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextSelectorStaticBinder.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextSelectorStaticBinder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/CopyOnInheritThreadLocal.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/CopyOnInheritThreadLocal.java
index 689195d0a094490a4a5bc42d583356586f1176df..fd456e8bdcccdd714f16f0a6813d5ebade258436 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/CopyOnInheritThreadLocal.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/CopyOnInheritThreadLocal.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/DefaultNestedComponentRules.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/DefaultNestedComponentRules.java
index e1f2e750dc147fa8b28c6aa8f8fb6b6c47b5865d..01ce7a32739e406295d458b4cc5578ca845ff2aa 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/DefaultNestedComponentRules.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/DefaultNestedComponentRules.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -16,15 +16,10 @@ package ch.qos.logback.classic.util;
import ch.qos.logback.classic.PatternLayout;
import ch.qos.logback.classic.boolex.JaninoEventEvaluator;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
-import ch.qos.logback.classic.net.SSLSocketAppender;
-import ch.qos.logback.classic.net.SSLSocketRemote;
-import ch.qos.logback.classic.net.server.SSLServerSocketAppender;
-import ch.qos.logback.classic.net.server.SocketServerNestedComponentRegistryRules;
import ch.qos.logback.core.AppenderBase;
import ch.qos.logback.core.UnsynchronizedAppenderBase;
import ch.qos.logback.core.filter.EvaluatorFilter;
import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
-import ch.qos.logback.core.net.ssl.SSLConfiguration;
import ch.qos.logback.core.net.ssl.SSLNestedComponentRegistryRules;
/**
@@ -47,11 +42,7 @@ public class DefaultNestedComponentRules {
registry
.add(EvaluatorFilter.class, "evaluator", JaninoEventEvaluator.class);
- registry.add(SSLSocketAppender.class, "ssl", SSLConfiguration.class);
- registry.add(SSLSocketRemote.class, "ssl", SSLConfiguration.class);
- registry.add(SSLServerSocketAppender.class, "ssl", SSLConfiguration.class);
SSLNestedComponentRegistryRules.addDefaultNestedComponentRegistryRules(registry);
- SocketServerNestedComponentRegistryRules.addDefaultNestedComponentRegistryRules(registry);
}
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/EnvUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/EnvUtil.java
index 4bec238cfc49bdefdb96eb932589b2acf646c5de..49af99af8ee00c1a713d7ed8792405cce3214eee 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/EnvUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/EnvUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/JNDIUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/JNDIUtil.java
index da8b6e6566423996d5fc694fb27252c87fd2ced0..75acc3c43495444e951c45d0dfe191087706619c 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/JNDIUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/JNDIUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -35,9 +35,10 @@ public class JNDIUtil {
return null;
}
try {
- return (String) ctx.lookup(name);
+ Object lookup = ctx.lookup(name);
+ return lookup == null ? null : lookup.toString();
} catch (NamingException e) {
return null;
}
}
-}
\ No newline at end of file
+}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/LevelToSyslogSeverity.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/LevelToSyslogSeverity.java
index 05df1efb71a07e669010f67a50c8ad43f023b5dc..5652d9bc2d2d176b8f5bfab57ea80445549da134 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/LevelToSyslogSeverity.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/LevelToSyslogSeverity.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java
index 7b752d1a9a4ca52b75d08be97caca75941747044..c467590e3f0d795723acf9e49f47ad62eca9df72 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/LoggerNameUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/LoggerNameUtil.java
index 29273b4ace97791cb7b1e6044f5ac6b23be57939..7f70179a8e10dd11d07b3d8840c7df4f81505ebc 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/LoggerNameUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/LoggerNameUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2012, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,7 +11,6 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.classic.util;
import ch.qos.logback.core.CoreConstants;
@@ -38,12 +37,14 @@ public class LoggerNameUtil {
* @return
*/
public static int getSeparatorIndexOf(String name, int fromIndex) {
- int i = name.indexOf(CoreConstants.DOT, fromIndex);
- if (i != -1) {
- return i;
- } else {
- return name.indexOf(CoreConstants.DOLLAR, fromIndex);
- }
+ int dotIndex = name.indexOf(CoreConstants.DOT, fromIndex);
+ int dollarIndex = name.indexOf(CoreConstants.DOLLAR, fromIndex);
+
+ if (dotIndex == -1 && dollarIndex == -1) return -1;
+ if (dotIndex == -1) return dollarIndex;
+ if (dollarIndex == -1) return dotIndex;
+
+ return dotIndex < dollarIndex ? dotIndex : dollarIndex;
}
public static List computeNameParts(String loggerName) {
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/StatusListenerConfigHelper.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/StatusListenerConfigHelper.java
index 7296244840122225f5e975acaf627d0b3bb0fc70..42737ffdb99cb6afcb3dd627d3020784f4f7220f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/StatusListenerConfigHelper.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/StatusListenerConfigHelper.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -30,26 +30,35 @@ public class StatusListenerConfigHelper {
}
}
- static void addStatusListener(LoggerContext loggerContext,
+ private static void addStatusListener(LoggerContext loggerContext,
String listenerClass) {
StatusListener listener = null;
if (ContextInitializer.SYSOUT.equalsIgnoreCase(listenerClass)) {
listener = new OnConsoleStatusListener();
} else {
- try {
- listener = (StatusListener) OptionHelper.instantiateByClassName(
- listenerClass, StatusListener.class, loggerContext);
- if(listener instanceof ContextAware) // LOGBACK-767
- ((ContextAware) listener).setContext(loggerContext);
- if(listener instanceof LifeCycle) // LOGBACK-767
- ((LifeCycle) listener).start();
- } catch (Exception e) {
- // printing on the console is the best we can do
- e.printStackTrace();
- }
+ listener = createListenerPerClassName(loggerContext, listenerClass);
}
+ initListener(loggerContext, listener);
+ }
+
+ private static void initListener(LoggerContext loggerContext, StatusListener listener) {
if (listener != null) {
+ if(listener instanceof ContextAware) // LOGBACK-767
+ ((ContextAware) listener).setContext(loggerContext);
+ if(listener instanceof LifeCycle) // LOGBACK-767
+ ((LifeCycle) listener).start();
loggerContext.getStatusManager().add(listener);
}
}
+
+ private static StatusListener createListenerPerClassName(LoggerContext loggerContext, String listenerClass) {
+ try {
+ return (StatusListener) OptionHelper.instantiateByClassName(
+ listenerClass, StatusListener.class, loggerContext);
+ } catch (Exception e) {
+ // printing on the console is the best we can do
+ e.printStackTrace();
+ return null;
+ }
+ }
}
diff --git a/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index c6fd6344d10a4344dca01ce094293e3e27268834..975c7de1dcb1adb22cf8515273a8713d1e99f0a0 100644
--- a/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/org/slf4j/impl/StaticMDCBinder.java b/logback-classic/src/main/java/org/slf4j/impl/StaticMDCBinder.java
index f83af57c1d3d949f701cf9468e97645f330a0753..f0cd2f8cbc1ace17e26507ce8f83866c287cb06c 100644
--- a/logback-classic/src/main/java/org/slf4j/impl/StaticMDCBinder.java
+++ b/logback-classic/src/main/java/org/slf4j/impl/StaticMDCBinder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/main/java/org/slf4j/impl/StaticMarkerBinder.java b/logback-classic/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
index d2c4e64f6c0b1b3a9beea1b8bab155b6bb2fe65a..4cd8b8a4ebfc324660363ea73ab831e07a0255c9 100644
--- a/logback-classic/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
+++ b/logback-classic/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/GafferConfiguratorTest.groovy b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/GafferConfiguratorTest.groovy
index 6f66c90f7c5b1be76ad426d374f194525f5d5954..78fd0ed62933e3ce0a3de8380c342b8d599551b1 100644
--- a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/GafferConfiguratorTest.groovy
+++ b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/GafferConfiguratorTest.groovy
@@ -17,6 +17,7 @@ import ch.qos.logback.classic.ClassicTestConstants
import ch.qos.logback.classic.LoggerContext
import org.junit.Before
import ch.qos.logback.core.testUtil.RandomUtil
+import org.junit.Ignore
import org.junit.Test
import ch.qos.logback.classic.Logger
import ch.qos.logback.classic.Level
@@ -39,122 +40,133 @@ import static org.junit.Assert.assertTrue
*/
class GafferConfiguratorTest {
- LoggerContext context = new LoggerContext();
- Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME)
- Logger logger = context.getLogger(this.getClass())
- int diff = RandomUtil.getPositiveInt();
- GafferConfigurator configurator = new GafferConfigurator(context);
-
- @Before
- void setUp() {
-
- }
-
- @Test
- void smoke() {
- File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "smoke.groovy")
- String dslText = file.text
- configurator.run dslText
- Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME);
- assertEquals(Level.WARN, root.level)
- assertNotNull(root.getAppender("C"))
- ConsoleAppender ca = root.getAppender("C")
- assertNotNull(ca.encoder)
- assertNotNull(ca.encoder.layout)
- PatternLayout layout = ca.encoder.layout
- assertEquals("%m%n", layout.pattern)
- }
-
- @Test
- void onTheFly() {
- File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "onTheFly.groovy")
- String dslText = file.text
- configurator.run dslText
- }
-
- @Test
- void contextName() {
- String dslText = "context.name = 'a'"
- configurator.run dslText
- assertEquals("a", context.name)
- }
-
- @Test
- void contextProperty() {
- String dslText = "context.putProperty('x', 'a')"
- configurator.run dslText
- assertEquals("a", context.getProperty("x"))
- }
-
- @Test
- void conversionRule() {
- File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "conversionRule.groovy")
- String dslText = file.text
- configurator.run dslText
-
- StringListAppender sla = (StringListAppender) root.getAppender("LIST");
- assertNotNull(sla);
- assertEquals(0, sla.strList.size());
-
- assertEquals(Level.DEBUG, root.level);
-
- String msg = "Simon says";
- logger.debug(msg);
- StatusPrinter.print context
- assertEquals(1, sla.strList.size());
- assertEquals(SampleConverter.SAMPLE_STR + " - " + msg, sla.strList.get(0));
- }
-
- @Test
- void evaluatorWithMatcher() {
- File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "evaluatorWithMatcher.groovy")
- String dslText = file.text
- configurator.run dslText
-
- ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT");
- assertTrue ca.isStarted()
-
- EvaluatorFilter ef = ca.getCopyOfAttachedFiltersList()[0];
- assertTrue ef.isStarted()
-
- JaninoEventEvaluator jee = ef.evaluator
- assertTrue jee.isStarted()
- Matcher m = jee.matcherList[0]
- assertTrue m.isStarted()
- }
-
- @Test
- void propertyCascading0() {
- File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading0.groovy")
- String dslText = file.text
- configurator.run dslText
-
- ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT");
- assertTrue ca.isStarted()
-
- assertEquals("HELLO %m%n", ca.encoder.layout.pattern)
- }
-
- @Test
- void propertyCascading1() {
- File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading1.groovy")
- String dslText = file.text
- configurator.run dslText
-
- ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT");
- assertTrue ca.isStarted()
- assertEquals("HELLO %m%n", ca.encoder.getLayout().pattern)
- }
-
- @Test
- void propertyCascading2() {
- context.putProperty("p", "HELLO");
- File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading2.groovy")
- String dslText = file.text
- configurator.run dslText
-
- ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT");
- assertTrue ca.isStarted()
- assertEquals("HELLO %m%n", ca.encoder.getLayout().pattern)
- }
+ LoggerContext context = new LoggerContext();
+ Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME)
+ Logger logger = context.getLogger(this.getClass())
+ int diff = RandomUtil.getPositiveInt();
+ GafferConfigurator configurator = new GafferConfigurator(context);
+
+ @Before
+ void setUp() {
+
+ }
+
+ @Test
+ void smoke() {
+ File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "smoke.groovy")
+ String dslText = file.text
+ configurator.run dslText
+ Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME);
+ assertEquals(Level.WARN, root.level)
+ assertNotNull(root.getAppender("C"))
+ ConsoleAppender ca = root.getAppender("C")
+ assertNotNull(ca.encoder)
+ assertNotNull(ca.encoder.layout)
+ PatternLayout layout = ca.encoder.layout
+ assertEquals("%m%n", layout.pattern)
+ }
+
+ @Test
+ void onTheFly() {
+ File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "onTheFly.groovy")
+ String dslText = file.text
+ configurator.run dslText
+ }
+
+ @Test
+ void contextName() {
+ String dslText = "context.name = 'a'"
+ configurator.run dslText
+ assertEquals("a", context.name)
+ }
+
+ @Test
+ void contextProperty() {
+ String dslText = "context.putProperty('x', 'a')"
+ configurator.run dslText
+ assertEquals("a", context.getProperty("x"))
+ }
+
+ @Test
+ void conversionRule() {
+ File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "conversionRule.groovy")
+ String dslText = file.text
+ configurator.run dslText
+
+ StringListAppender sla = (StringListAppender) root.getAppender("LIST");
+ assertNotNull(sla);
+ assertEquals(0, sla.strList.size());
+
+ assertEquals(Level.DEBUG, root.level);
+
+ String msg = "Simon says";
+ logger.debug(msg);
+ StatusPrinter.print context
+ assertEquals(1, sla.strList.size());
+ assertEquals(SampleConverter.SAMPLE_STR + " - " + msg, sla.strList.get(0));
+ }
+
+ @Test
+ void evaluatorWithMatcher() {
+ File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "evaluatorWithMatcher.groovy")
+ String dslText = file.text
+ configurator.run dslText
+
+ ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT");
+ assertTrue ca.isStarted()
+
+ EvaluatorFilter ef = ca.getCopyOfAttachedFiltersList()[0];
+ assertTrue ef.isStarted()
+
+ JaninoEventEvaluator jee = ef.evaluator
+ assertTrue jee.isStarted()
+ Matcher m = jee.matcherList[0]
+ assertTrue m.isStarted()
+ }
+
+ @Test
+ void propertyCascading0() {
+ File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading0.groovy")
+ String dslText = file.text
+ configurator.run dslText
+
+ ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT");
+ assertTrue ca.isStarted()
+
+ assertEquals("HELLO %m%n", ca.encoder.layout.pattern)
+ }
+
+ @Test
+ void propertyCascading1() {
+ File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading1.groovy")
+ String dslText = file.text
+ configurator.run dslText
+
+ ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT");
+ assertTrue ca.isStarted()
+ assertEquals("HELLO %m%n", ca.encoder.getLayout().pattern)
+ }
+
+ @Test
+ void propertyCascading2() {
+ context.putProperty("p", "HELLO");
+ File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading2.groovy")
+ String dslText = file.text
+ configurator.run dslText
+
+ ConsoleAppender ca = (ConsoleAppender) root.getAppender("STDOUT");
+ assertTrue ca.isStarted()
+ assertEquals("HELLO %m%n", ca.encoder.getLayout().pattern)
+ }
+
+
+ @Test
+ @Ignore
+ void receiver() {
+ File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + "propertyCascading2.groovy")
+ String dslText = file.text
+ configurator.run dslText
+ }
+
+
}
diff --git a/logback-classic/src/test/groovy/ch/qos/logback/classic/sift/GSiftingAppenderTest.groovy b/logback-classic/src/test/groovy/ch/qos/logback/classic/sift/GSiftingAppenderTest.groovy
deleted file mode 100644
index df62eea1a257ac758a8411a201e630cbc688aa2a..0000000000000000000000000000000000000000
--- a/logback-classic/src/test/groovy/ch/qos/logback/classic/sift/GSiftingAppenderTest.groovy
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2010, 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.classic.sift
-
-import ch.qos.logback.classic.gaffer.GafferConfigurator
-
-import ch.qos.logback.classic.Logger
-import ch.qos.logback.classic.LoggerContext
-import ch.qos.logback.core.testUtil.RandomUtil
-import org.junit.Test
-import ch.qos.logback.classic.ClassicTestConstants
-import org.slf4j.MDC
-import static junit.framework.Assert.assertNotNull
-import ch.qos.logback.core.sift.AppenderTracker
-import ch.qos.logback.core.read.ListAppender
-import ch.qos.logback.core.util.StatusPrinter
-import static junit.framework.Assert.assertEquals
-import ch.qos.logback.core.FileAppender
-import ch.qos.logback.core.status.StatusChecker
-import ch.qos.logback.core.status.Status
-import static junit.framework.Assert.assertNull
-import org.junit.After
-import static ch.qos.logback.classic.ClassicTestConstants.OUTPUT_DIR_PREFIX;
-
-/**
- * @author Ceki Gücü
- */
-class GSiftingAppenderTest {
-
- LoggerContext context = new LoggerContext();
- Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME)
- Logger logger = context.getLogger(this.getClass())
- int diff = RandomUtil.getPositiveInt();
- GafferConfigurator configurator = new GafferConfigurator(context);
- StatusChecker checker = new StatusChecker(context)
-
- @After
- public void tearDown() {
- MDC.clear();
- }
-
- AppenderTracker execute(String path) {
- File file = new File(ClassicTestConstants.GAFFER_INPUT_PREFIX + path)
- String dslText = file.text
- configurator.run dslText
-
- GSiftingAppender sa = (GSiftingAppender) root.getAppender("SIFT");
- assertNotNull(sa)
- AppenderTracker tracker = sa.getAppenderTracker();
- }
-
- @Test
- void noDiscriminator() {
- AppenderTracker tracker = execute("sift/noDiscriminator.groovy")
- logger.debug("x")
- ListAppender unknownAppender = tracker.get("unknown", System.currentTimeMillis())
- assertNull(unknownAppender)
- checker.containsMatch(Status.ERROR, "Missing discriminator. Aborting")
- }
-
- @Test
- void sample0() {
- AppenderTracker tracker = execute("sift/sample0.groovy")
- logger.debug("x")
- ListAppender unknownAppender = tracker.get("unknown", System.currentTimeMillis())
- assertNotNull(unknownAppender)
-
- MDC.put("userid", "a");
- logger.debug("y");
- ListAppender aAppender = tracker.get("a", System.currentTimeMillis())
- assertNotNull(aAppender)
-
- assertEquals(1, unknownAppender.list.size);
- assertEquals("x", unknownAppender.list[0].message)
- assertEquals(1, aAppender.list.size);
- assertEquals("y", aAppender.list[0].message)
- }
-
- @Test
- void sample1() {
- AppenderTracker tracker = execute("sift/sample1.groovy")
- logger.debug("x")
-
- StatusPrinter.print context
- FileAppender unknownAppender = tracker.get("unknown", System.currentTimeMillis())
- assertNotNull(unknownAppender)
- assertEquals("FILE-unknown", unknownAppender.name)
- assertEquals(OUTPUT_DIR_PREFIX+"test-unknown.log", unknownAppender.file)
-
- MDC.put("userid", "a");
- logger.debug("y");
- FileAppender aAppender = tracker.get("a", System.currentTimeMillis())
- assertNotNull(aAppender)
- assertEquals("FILE-a", aAppender.name)
- assertEquals(OUTPUT_DIR_PREFIX+"test-a.log", aAppender.file)
- assertEquals("a - %msg%n", aAppender.encoder.pattern)
- }
-
-
-}
diff --git a/logback-classic/src/test/input/joran/jul/levelChangePropagator0.xml b/logback-classic/src/test/input/joran/jul/levelChangePropagator0.xml
index 6052995d031d451e99bc92a4306de36a8a721ef5..6ecf75e93389ee243b1f8b08ebb81626c305e1d6 100644
--- a/logback-classic/src/test/input/joran/jul/levelChangePropagator0.xml
+++ b/logback-classic/src/test/input/joran/jul/levelChangePropagator0.xml
@@ -3,7 +3,7 @@
true
-
+
diff --git a/logback-classic/src/test/input/joran/jul/levelChangePropagator1.xml b/logback-classic/src/test/input/joran/jul/levelChangePropagator1.xml
index a7f4d4e0f5c1b38c81ce29025d23f6fbac5f0c9a..231e13f84daf4acdb1dfdef6b2169e7bfa8ae310 100644
--- a/logback-classic/src/test/input/joran/jul/levelChangePropagator1.xml
+++ b/logback-classic/src/test/input/joran/jul/levelChangePropagator1.xml
@@ -1,7 +1,8 @@
-
+
+
diff --git a/logback-classic/src/test/input/joran/sift/compositeProperty.xml b/logback-classic/src/test/input/joran/sift/compositeProperty.xml
new file mode 100644
index 0000000000000000000000000000000000000000..37ed96bd51b83340f51cf941627ac719459fd5cb
--- /dev/null
+++ b/logback-classic/src/test/input/joran/sift/compositeProperty.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+ compositeProperty
+ default
+
+
+
+
+
+
+ ${Z}%msg
+
+
+
+
+
+
+
+
+
+
diff --git a/logback-classic/src/test/input/joran/sift/defaultLayoutRule.xml b/logback-classic/src/test/input/joran/sift/defaultLayoutRule.xml
index 7e4213d1c80a3f945dd71a0ca8830f75f356143d..b8753ea78ae57940adb13f33b1256af8e30cd178 100644
--- a/logback-classic/src/test/input/joran/sift/defaultLayoutRule.xml
+++ b/logback-classic/src/test/input/joran/sift/defaultLayoutRule.xml
@@ -1,16 +1,15 @@
-
- userid
+ useriddefault
- %level %msg
+ %level %msg
diff --git a/logback-classic/src/test/input/joran/sift/hoard0.xml b/logback-classic/src/test/input/joran/sift/hoard0.xml
index 930f5502cd73758780c1d88f241cb4d40f4ace07..d1673bf921fd68f33b78eb6c8226beea9e011ae8 100644
--- a/logback-classic/src/test/input/joran/sift/hoard0.xml
+++ b/logback-classic/src/test/input/joran/sift/hoard0.xml
@@ -3,17 +3,16 @@
-
+ useridasdad
- ${userid}.log
- true
+ ${userid}.log
+ true
- %d [%thread] %level %logger{35} - %msg%n
+ %d [%thread] %level %logger{35} - %msg%n
diff --git a/logback-classic/src/test/input/joran/sift/lbclassic203.xml b/logback-classic/src/test/input/joran/sift/lbclassic203.xml
index 5db0eb816e864fcd16d393b5807095b2e1219d27..646d6a2441d20cfe3e1eef09ab77d180fbd9863b 100644
--- a/logback-classic/src/test/input/joran/sift/lbclassic203.xml
+++ b/logback-classic/src/test/input/joran/sift/lbclassic203.xml
@@ -9,7 +9,7 @@
- userid
+ useridsmoke
diff --git a/logback-classic/src/test/input/joran/sift/lingering.xml b/logback-classic/src/test/input/joran/sift/lingering.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5c53496e159a3e18b84ab58f031488f915af5552
--- /dev/null
+++ b/logback-classic/src/test/input/joran/sift/lingering.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+ linger
+ linger
+
+
+
+
+
+
+
+
+
+
+
diff --git a/logback-classic/src/test/input/joran/sift/maxAppenderCount.xml b/logback-classic/src/test/input/joran/sift/maxAppenderCount.xml
new file mode 100644
index 0000000000000000000000000000000000000000..90c5957d4d834a227e2031b89a5f73b901979131
--- /dev/null
+++ b/logback-classic/src/test/input/joran/sift/maxAppenderCount.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+ max
+ default
+
+ 5
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/logback-classic/src/test/input/joran/sift/multipleNesting.xml b/logback-classic/src/test/input/joran/sift/multipleNesting.xml
index 2dccd197c8ac2b2b82c0e6deb82a759ed8b56e46..40d572a0ab28f55704fbd6d71c43d192d2a67066 100644
--- a/logback-classic/src/test/input/joran/sift/multipleNesting.xml
+++ b/logback-classic/src/test/input/joran/sift/multipleNesting.xml
@@ -6,14 +6,12 @@
- userid
- smoke
+ userid
+ multipleDefault
-
-
+
+
diff --git a/logback-classic/src/test/input/joran/sift/propertyDefinedInSiftElement.xml b/logback-classic/src/test/input/joran/sift/propertyDefinedInSiftElement.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6a08c63a11cc4ee9b3b598e1e8de320a22704134
--- /dev/null
+++ b/logback-classic/src/test/input/joran/sift/propertyDefinedInSiftElement.xml
@@ -0,0 +1,24 @@
+
+
+
+
+ propertyDefinedWithinSift
+ default
+
+
+
+
+
+
+ ${X}%msg
+
+
+
+
+
+
+
+
+
+
diff --git a/logback-classic/src/test/input/joran/sift/propertyPropagation.xml b/logback-classic/src/test/input/joran/sift/propertyPropagation.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ab7ff7dae4ce0d94abce4d4a7442b98d1cec8aa2
--- /dev/null
+++ b/logback-classic/src/test/input/joran/sift/propertyPropagation.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+ localProperty
+ default
+
+
+
+
+ ${X}%msg
+
+
+
+
+
+
+
+
+
+
diff --git a/logback-classic/src/test/input/joran/sift/smoke.xml b/logback-classic/src/test/input/joran/sift/smoke.xml
index 91e3f565a600fc9dea70ec94b30c2e1fa601fbf5..846fd14a087ee556bb5fdb089327ffd45a5abe27 100644
--- a/logback-classic/src/test/input/joran/sift/smoke.xml
+++ b/logback-classic/src/test/input/joran/sift/smoke.xml
@@ -6,8 +6,8 @@
- userid
- smoke
+ userid
+ smokeDefault
+
+
+
+
+
+
+
+ timeout
+ smoke
+
+ 30 seconds
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/logback-classic/src/test/input/joran/sift/unsetDefaultValueProperty.xml b/logback-classic/src/test/input/joran/sift/unsetDefaultValueProperty.xml
index 7afa57b9fafde7c26c9cb27e35d72273d66afd8d..95615cbdd7639579f0e98b14d0a5fb5bc1db7400 100644
--- a/logback-classic/src/test/input/joran/sift/unsetDefaultValueProperty.xml
+++ b/logback-classic/src/test/input/joran/sift/unsetDefaultValueProperty.xml
@@ -6,7 +6,7 @@
- userid
+ userid
- userid
- smoke
+ userid
+ zeroDefault
diff --git a/logback-classic/src/test/input/joran/smtp/customBufferSize.xml b/logback-classic/src/test/input/joran/smtp/customBufferSize.xml
index 65bda73361a366e7cb728b859766e35c89f3b4d1..5383b90a41f0027e3803de2b13f01a868df80a5b 100644
--- a/logback-classic/src/test/input/joran/smtp/customBufferSize.xml
+++ b/logback-classic/src/test/input/joran/smtp/customBufferSize.xml
@@ -5,9 +5,9 @@
${port}nospam@qos.chuser@host.dom
- %logger - %m
+ testCustomBufferSize %logger - %m
-
+ 1
diff --git a/logback-classic/src/test/input/joran/smtp/customEvaluator.xml b/logback-classic/src/test/input/joran/smtp/customEvaluator.xml
index f5405da8328b3ab361fc7a74d9c4774286e0e5ef..b2e39a76dfccc4bddeb9b14183ec503f80984f21 100644
--- a/logback-classic/src/test/input/joran/smtp/customEvaluator.xml
+++ b/logback-classic/src/test/input/joran/smtp/customEvaluator.xml
@@ -5,7 +5,7 @@
${port}nospam@qos.chuser@host.dom
- %logger - %m
+ testCustomEvaluator %logger - %m2
diff --git a/logback-classic/src/test/input/joran/timestamp-context.xml b/logback-classic/src/test/input/joran/timestamp-context.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f184f5ac4eaece9aa77466df08f73949ab57de79
--- /dev/null
+++ b/logback-classic/src/test/input/joran/timestamp-context.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/logback-classic/src/test/input/joran/timestamp-local.xml b/logback-classic/src/test/input/joran/timestamp-local.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dd20ba01dac4f8316418d7b28c7439b0104bfd24
--- /dev/null
+++ b/logback-classic/src/test/input/joran/timestamp-local.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/logback-classic/src/test/input/joran/timestamp.xml b/logback-classic/src/test/input/joran/timestamp.xml
deleted file mode 100644
index e36da68144f51a50f90349d614b44f7f3814c4a2..0000000000000000000000000000000000000000
--- a/logback-classic/src/test/input/joran/timestamp.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java
index c06b086bea5df4d0ec503008b5ac29dbdf65359c..5d998fc1d90d7380f5fdb03e302ed09f666af0de 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/AllClassicTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/AsyncAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/AsyncAppenderTest.java
index 990dc9a0fefaf220ee25f25fdbe259ff6303399a..20702136405aec93c14963031279c67def23cb1a 100755
--- a/logback-classic/src/test/java/ch/qos/logback/classic/AsyncAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/AsyncAppenderTest.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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.classic;
import ch.qos.logback.classic.net.testObjectBuilders.LoggingEventBuilderInContext;
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/ClassicTestConstants.java b/logback-classic/src/test/java/ch/qos/logback/classic/ClassicTestConstants.java
index 2bf62828124c3fdf8b1d75833b2b041af11a1a60..597dd67be75777a2abba2531d6b8d52ff518e2c9 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/ClassicTestConstants.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/ClassicTestConstants.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/Foo.java b/logback-classic/src/test/java/ch/qos/logback/classic/Foo.java
index bcee0ca82cbe52a0d5cd4cced551ebf5d1360ea7..a171c50e21b0558a09e2f7d57406eb656a4c9cde 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/Foo.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/Foo.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/HLogger.java b/logback-classic/src/test/java/ch/qos/logback/classic/HLogger.java
index a9ec26b19b9e84858106e25af7f273dd7b3a4601..b42f87de233e7b78e0ef1b4b3ab49a9841b328f0 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/HLogger.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/HLogger.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/HLoggerContext.java b/logback-classic/src/test/java/ch/qos/logback/classic/HLoggerContext.java
index d5f5fb3a345472c445eec5f79489409fdedb1427..5d9d7396aa94ce4927d615a8ca799d1eb313b6a7 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/HLoggerContext.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/HLoggerContext.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextDeadlockTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextDeadlockTest.java
index 774d6e915f7f3168976f2c869b0b0f1f7840ec30..cc8ed20aff76d3b0269ad98d4d40f897ea9e4376 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextDeadlockTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextDeadlockTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java
index 6b37896884f9182472145121eb4ede4620e1288d..17e6702eab41d1fad94ac51f8902c40cc18c79ad 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/MessageFormattingTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerMessageFormattingTest.java
old mode 100644
new mode 100755
similarity index 96%
rename from logback-classic/src/test/java/ch/qos/logback/classic/MessageFormattingTest.java
rename to logback-classic/src/test/java/ch/qos/logback/classic/LoggerMessageFormattingTest.java
index c6974209f683af1cebdbe38b4cfad3f5a192889c..c9b5bd9c8411673cb40f0170b76ba94c9d2bb1d5
--- a/logback-classic/src/test/java/ch/qos/logback/classic/MessageFormattingTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerMessageFormattingTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -21,7 +21,7 @@ import org.junit.Test;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.read.ListAppender;
-public class MessageFormattingTest {
+public class LoggerMessageFormattingTest {
LoggerContext lc;
ListAppender listAppender;
@@ -81,4 +81,6 @@ public class MessageFormattingTest {
assertEquals("12", formattedMessage);
}
+
+
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerPerfTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerPerfTest.java
index 01db530171874326ed996ddd887015c79ad944ba..7aebc7123e96dcb40f26096ef0bed781bb2d621e 100755
--- a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerPerfTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerPerfTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerSerializationTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerSerializationTest.java
index 99805ba0785c52459437a8e326fae397a5f2de87..3e33063b3b47bf76665c34a338cb071903fdfb6a 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerSerializationTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerSerializationTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerTest.java
index 6b9f65c94846cdd1b62af7522961fb437d1c48eb..d7a5dc67e008556a8b5fe17ee21657add196f9e7 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerTestHelper.java b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerTestHelper.java
index 7a68162444e0be9c64dd2b7234b3e293a2db6f5d..aa84d64c380ec581b6f4ee03e73ac9eabd8ac2d7 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/LoggerTestHelper.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/LoggerTestHelper.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/MDCTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/MDCTest.java
index 7234a4b6b8bf1e5f25edbda3bb482c250a574d76..bcd5bae2f388bf729f5a975bcab3f58276729243 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/MDCTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/MDCTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/MDCTestThread.java b/logback-classic/src/test/java/ch/qos/logback/classic/MDCTestThread.java
index f1e9a9605557a6796d53ffcd74553cad341be48c..f59e9745eb30caa0b179b262496657f523f8365e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/MDCTestThread.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/MDCTestThread.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/PackageTest.java
old mode 100644
new mode 100755
index a5ec680add627d83eb6d4da6163e42a4bbf36b28..ebd1806da102d7017eee44161e39672deedb3af7
--- a/logback-classic/src/test/java/ch/qos/logback/classic/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -21,7 +21,7 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses({LoggerContextTest.class, LoggerPerfTest.class,
ScenarioBasedLoggerContextTest.class, PatternLayoutTest.class,
LoggerTest.class, LoggerSerializationTest.class,
- MessageFormattingTest.class, MDCTest.class,
+ LoggerMessageFormattingTest.class, MDCTest.class,
TurboFilteringInLoggerTest.class,
AsyncAppenderTest.class})
public class PackageTest {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
index 2429a83442fd6bd8551a19c689d7607f11e00afc..3c7b16bda9387997c0b635d9917dc3b3a96a89ee 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,19 +13,6 @@
*/
package ch.qos.logback.classic;
-import static ch.qos.logback.classic.ClassicTestConstants.ISO_REGEX;
-import static ch.qos.logback.classic.ClassicTestConstants.MAIN_REGEX;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import ch.qos.logback.core.util.StatusPrinter;
-import org.junit.Before;
-import org.junit.Test;
-
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.classic.pattern.ConverterTest;
import ch.qos.logback.classic.spi.ILoggingEvent;
@@ -36,6 +23,15 @@ import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.pattern.PatternLayoutBase;
import ch.qos.logback.core.pattern.parser.AbstractPatternLayoutBaseTest;
import ch.qos.logback.core.testUtil.StringListAppender;
+import ch.qos.logback.core.util.OptionHelper;
+import ch.qos.logback.core.util.StatusPrinter;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.MDC;
+
+import static ch.qos.logback.classic.ClassicTestConstants.ISO_REGEX;
+import static ch.qos.logback.classic.ClassicTestConstants.MAIN_REGEX;
+import static org.junit.Assert.*;
public class PatternLayoutTest extends AbstractPatternLayoutBaseTest {
@@ -45,9 +41,8 @@ public class PatternLayoutTest extends AbstractPatternLayoutBaseTest optionList = new ArrayList();
- public PatternLayoutTest() {
+ public PatternLayoutTest() {
super();
Exception ex = new Exception("Bogus exception");
le = makeLoggingEvent(ex);
@@ -147,6 +142,20 @@ public class PatternLayoutTest extends AbstractPatternLayoutBaseTest cbTracker;
+ CyclicBuffer cb;
@Before
public void setUp() throws Exception {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/ExternalMockSocketServer.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/ExternalMockSocketServer.java
index 74643def5a3cd6942d1df28bc478838c9ac201b0..659dc7e2df16f035a23cc50f08f60fa971500b99 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/ExternalMockSocketServer.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/ExternalMockSocketServer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java
index 4113770bed2f6eaddebcc915f2999f3ab7cbeb5a..1fc169ecf2172b41c2897318c461ca7480af57dd 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTestApp.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTestApp.java
index 624871da9ddb0caa97cb99b3886b7ab7ca57ba68..64ced9fdd934a432ef53e6fd5641400b6a8c843e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTestApp.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTestApp.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java
index 6139d743f3e0f041db282208a4d97b250a2798ef..cfdff9d192465fa4f44135bcf6867bc985033c0e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTestApp.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTestApp.java
index 298b1efa369220cb12fabf9a44fde20a2c7a6ee9..f5a5f7d8c7c6256b3a5d1ce3f2f281e00c4ef66b 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTestApp.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTestApp.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/NOPOutputStream.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/NOPOutputStream.java
index b0efe9097e6bd5af004118af305d949fa140681e..42b4aea4bd0e6d17dbc92ceb8dba5648b798d689 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/NOPOutputStream.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/NOPOutputStream.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java
index e6b6d805f18a9659795d71b2cf1c88af315a8598..6664d91f6a8b8cd92a804268b628c58bfeef9790 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -19,8 +19,8 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses( { SyslogAppenderTest.class, DilutedSMTPAppenderTest.class,
- SocketAppenderTest.class, JMSQueueAppenderTest.class, JMSTopicAppenderTest.class,
+ JMSQueueAppenderTest.class, JMSTopicAppenderTest.class,
SMTPAppender_GreenTest.class, SMTPAppender_SubethaSMTPTest.class,
- SocketRemoteTest.class })
+ SocketReceiverTest.class, SSLSocketReceiverTest.class })
public class PackageTest {
}
\ No newline at end of file
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
index de2b59fcbd9cfe3f3e1e7154fcb29e0bd6a9033b..541f14c922b83cfca1428d15c01bcbc0a30b2861 100755
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,19 +13,6 @@
*/
package ch.qos.logback.classic.net;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.concurrent.TimeUnit;
-
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-
-import org.dom4j.io.SAXReader;
-import org.junit.*;
-import org.slf4j.MDC;
-
import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
@@ -36,43 +23,64 @@ import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Layout;
import ch.qos.logback.core.joran.spi.JoranException;
+import ch.qos.logback.core.status.OnConsoleStatusListener;
+import ch.qos.logback.core.testUtil.EnvUtilForTests;
import ch.qos.logback.core.testUtil.RandomUtil;
-
+import ch.qos.logback.core.util.CoreTestConstants;
import com.icegreen.greenmail.util.GreenMail;
import com.icegreen.greenmail.util.GreenMailUtil;
import com.icegreen.greenmail.util.ServerSetup;
+import org.dom4j.DocumentException;
+import org.dom4j.io.SAXReader;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.MDC;
+
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.TimeUnit;
import static org.junit.Assert.*;
public class SMTPAppender_GreenTest {
- static boolean SYNCHRONOUS = false;
- static boolean ASYNCHRONOUS = true;
- static int port = RandomUtil.getRandomServerPort();
- static GreenMail greenMailServer;
-
- SMTPAppender smtpAppender;
- LoggerContext lc = new LoggerContext();
- Logger logger = lc.getLogger(this.getClass());
-
- static final String TEST_SUBJECT = "test subject";
static final String HEADER = "HEADER\n";
static final String FOOTER = "FOOTER\n";
static final String DEFAULT_PATTERN = "%-4relative %mdc [%thread] %-5level %class - %msg%n";
+ static final boolean SYNCHRONOUS = false;
+ static final boolean ASYNCHRONOUS = true;
+ int port = RandomUtil.getRandomServerPort();
+ // GreenMail cannot be static. As a shared server induces race conditions
+ GreenMail greenMailServer;
+
+ SMTPAppender smtpAppender;
+ LoggerContext loggerContext = new LoggerContext();
+ Logger logger = loggerContext.getLogger(this.getClass());
- int oldCount;
@Before
public void setUp() throws Exception {
+
+ OnConsoleStatusListener.addNewInstanceToContext(loggerContext);
+ MDC.clear();
ServerSetup serverSetup = new ServerSetup(port, "localhost",
ServerSetup.PROTOCOL_SMTP);
greenMailServer = new GreenMail(serverSetup);
greenMailServer.start();
-
- MDC.clear();
- oldCount = messageCount();
+ // give the server a head start
+ if (EnvUtilForTests.isRunningOnSlowJenkins()) {
+ Thread.currentThread().sleep(2000);
+ } else {
+ Thread.currentThread().sleep(50);
+ }
}
@After
@@ -80,22 +88,21 @@ public class SMTPAppender_GreenTest {
greenMailServer.stop();
}
- void buildSMTPAppender(boolean synchronicity) throws Exception {
+ void buildSMTPAppender(String subject, boolean synchronicity) throws Exception {
smtpAppender = new SMTPAppender();
- smtpAppender.setContext(lc);
+ smtpAppender.setContext(loggerContext);
smtpAppender.setName("smtp");
smtpAppender.setFrom("user@host.dom");
smtpAppender.setSMTPHost("localhost");
smtpAppender.setSMTPPort(port);
- smtpAppender.setSubject(TEST_SUBJECT);
+ smtpAppender.setSubject(subject);
smtpAppender.addTo("nospam@qos.ch");
smtpAppender.setAsynchronousSending(synchronicity);
- // smtpAppender.start();
}
- private Layout buildPatternLayout(LoggerContext lc, String pattern) {
+ private Layout buildPatternLayout(String pattern) {
PatternLayout layout = new PatternLayout();
- layout.setContext(lc);
+ layout.setContext(loggerContext);
layout.setFileHeader(HEADER);
layout.setOutputPatternAsHeader(false);
layout.setPattern(pattern);
@@ -104,27 +111,27 @@ public class SMTPAppender_GreenTest {
return layout;
}
- private Layout buildHTMLLayout(LoggerContext lc) {
+ private Layout buildHTMLLayout() {
HTMLLayout layout = new HTMLLayout();
- layout.setContext(lc);
- // layout.setFileHeader(HEADER);
+ layout.setContext(loggerContext);
layout.setPattern("%level%class%msg");
- // layout.setFileFooter(FOOTER);
layout.start();
return layout;
}
- private int messageCount() throws MessagingException, IOException {
- MimeMessage[] mma = greenMailServer.getReceivedMessages();
- assertNotNull(mma);
- return mma.length;
+ private void waitForServerToReceiveEmails(int emailCount) throws InterruptedException {
+ greenMailServer.waitForIncomingEmail(5000, emailCount);
}
- private MimeMultipart verify(String subject) throws MessagingException,
- IOException {
+ private MimeMultipart verifyAndExtractMimeMultipart(String subject) throws MessagingException,
+ IOException, InterruptedException {
+ int oldCount = 0;
+ int expectedEmailCount = 1;
+ // wait for the server to receive the messages
+ waitForServerToReceiveEmails(expectedEmailCount);
MimeMessage[] mma = greenMailServer.getReceivedMessages();
assertNotNull(mma);
- assertEquals(oldCount + 1, mma.length);
+ assertEquals(expectedEmailCount, mma.length);
MimeMessage mm = mma[oldCount];
// http://jira.qos.ch/browse/LBCLASSIC-67
assertEquals(subject, mm.getSubject());
@@ -132,37 +139,39 @@ public class SMTPAppender_GreenTest {
}
void waitUntilEmailIsSent() throws InterruptedException {
- lc.getExecutorService().shutdown();
- lc.getExecutorService().awaitTermination(1000, TimeUnit.MILLISECONDS);
+ loggerContext.getExecutorService().shutdown();
+ loggerContext.getExecutorService().awaitTermination(1000, TimeUnit.MILLISECONDS);
}
@Test
- public void syncronousSmoke() throws Exception {
- buildSMTPAppender(SYNCHRONOUS);
+ public void synchronousSmoke() throws Exception {
+ String subject = "synchronousSmoke";
+ buildSMTPAppender(subject, SYNCHRONOUS);
- smtpAppender.setLayout(buildPatternLayout(lc, DEFAULT_PATTERN));
+ smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN));
smtpAppender.start();
logger.addAppender(smtpAppender);
logger.debug("hello");
logger.error("en error", new Exception("an exception"));
- MimeMultipart mp = verify(TEST_SUBJECT);
+ MimeMultipart mp = verifyAndExtractMimeMultipart(subject);
String body = GreenMailUtil.getBody(mp.getBodyPart(0));
assertTrue(body.startsWith(HEADER.trim()));
assertTrue(body.endsWith(FOOTER.trim()));
}
@Test
- public void asyncronousSmoke() throws Exception {
- buildSMTPAppender(ASYNCHRONOUS);
- smtpAppender.setLayout(buildPatternLayout(lc, DEFAULT_PATTERN));
+ public void asynchronousSmoke() throws Exception {
+ String subject = "asynchronousSmoke";
+ buildSMTPAppender(subject, ASYNCHRONOUS);
+ smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN));
smtpAppender.start();
logger.addAppender(smtpAppender);
logger.debug("hello");
logger.error("en error", new Exception("an exception"));
waitUntilEmailIsSent();
- MimeMultipart mp = verify(TEST_SUBJECT);
+ MimeMultipart mp = verifyAndExtractMimeMultipart(subject);
String body = GreenMailUtil.getBody(mp.getBodyPart(0));
assertTrue(body.startsWith(HEADER.trim()));
assertTrue(body.endsWith(FOOTER.trim()));
@@ -170,34 +179,37 @@ public class SMTPAppender_GreenTest {
// See also http://jira.qos.ch/browse/LOGBACK-734
@Test
- public void callerDataShouldBeCorrectlySetWithAsyncronousSending() throws Exception {
- buildSMTPAppender(ASYNCHRONOUS);
- smtpAppender.setLayout(buildPatternLayout(lc,DEFAULT_PATTERN));
+ public void callerDataShouldBeCorrectlySetWithAsynchronousSending() throws Exception {
+ String subject = "LOGBACK-734";
+ buildSMTPAppender("LOGBACK-734", ASYNCHRONOUS);
+ smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN));
smtpAppender.setIncludeCallerData(true);
smtpAppender.start();
logger.addAppender(smtpAppender);
- logger.debug("hello");
- logger.error("en error", new Exception("an exception"));
+ logger.debug("LOGBACK-734");
+ logger.error("callerData", new Exception("ShouldBeCorrectlySetWithAsynchronousSending"));
waitUntilEmailIsSent();
- MimeMultipart mp = verify(TEST_SUBJECT);
+ MimeMultipart mp = verifyAndExtractMimeMultipart(subject);
String body = GreenMailUtil.getBody(mp.getBodyPart(0));
- assertTrue(body.contains("DEBUG "+this.getClass().getName()+" - hello"));
+ assertTrue("actual [" + body + "]", body.contains("DEBUG " + this.getClass().getName() + " - LOGBACK-734"));
}
+
// lost MDC
@Test
public void LBCLASSIC_104() throws Exception {
- buildSMTPAppender(SYNCHRONOUS);
+ String subject = "LBCLASSIC_104";
+ buildSMTPAppender(subject, SYNCHRONOUS);
smtpAppender.setAsynchronousSending(false);
- smtpAppender.setLayout(buildPatternLayout(lc, DEFAULT_PATTERN));
+ smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN));
smtpAppender.start();
logger.addAppender(smtpAppender);
MDC.put("key", "val");
logger.debug("LBCLASSIC_104");
MDC.clear();
- logger.error("en error", new Exception("an exception"));
+ logger.error("en error", new Exception("test"));
- MimeMultipart mp = verify(TEST_SUBJECT);
+ MimeMultipart mp = verifyAndExtractMimeMultipart(subject);
String body = GreenMailUtil.getBody(mp.getBodyPart(0));
assertTrue(body.startsWith(HEADER.trim()));
System.out.println(body);
@@ -207,22 +219,30 @@ public class SMTPAppender_GreenTest {
@Test
public void html() throws Exception {
- buildSMTPAppender(SYNCHRONOUS);
+ String subject = "html";
+ buildSMTPAppender(subject, SYNCHRONOUS);
smtpAppender.setAsynchronousSending(false);
- smtpAppender.setLayout(buildHTMLLayout(lc));
+ smtpAppender.setLayout(buildHTMLLayout());
smtpAppender.start();
logger.addAppender(smtpAppender);
logger.debug("html");
logger.error("en error", new Exception("an exception"));
- MimeMultipart mp = verify(TEST_SUBJECT);
+ MimeMultipart mp = verifyAndExtractMimeMultipart(subject);
- // verify strict adherence to xhtml1-strict.dtd
+ // verifyAndExtractMimeMultipart strict adherence to xhtml1-strict.dtd
SAXReader reader = new SAXReader();
reader.setValidation(true);
reader.setEntityResolver(new XHTMLEntityResolver());
- reader.read(mp.getBodyPart(0).getInputStream());
-
+ byte[] messageBytes = getAsByteArray(mp.getBodyPart(0).getInputStream());
+ ByteArrayInputStream bais = new ByteArrayInputStream(messageBytes);
+ try {
+ reader.read(bais);
+ } catch (DocumentException de) {
+ System.out.println("incoming message:");
+ System.out.println(new String(messageBytes));
+ throw de;
+ }
}
private byte[] getAsByteArray(InputStream inputStream) throws IOException {
@@ -230,7 +250,7 @@ public class SMTPAppender_GreenTest {
byte[] buffer = new byte[1024];
int n = -1;
- while((n = inputStream.read(buffer)) != -1) {
+ while ((n = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, n);
}
return baos.toByteArray();
@@ -238,9 +258,8 @@ public class SMTPAppender_GreenTest {
private void configure(String file) throws JoranException {
JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(lc);
- System.out.println("port=" + port);
- lc.putProperty("port", "" + port);
+ jc.setContext(loggerContext);
+ loggerContext.putProperty("port", "" + port);
jc.doConfigure(file);
}
@@ -249,14 +268,14 @@ public class SMTPAppender_GreenTest {
configure(ClassicTestConstants.JORAN_INPUT_PREFIX
+ "smtp/customEvaluator.xml");
- logger.debug("hello");
- String msg2 = "world";
+ logger.debug("test");
+ String msg2 = "CustomEvaluator";
logger.debug(msg2);
logger.debug("invisible");
waitUntilEmailIsSent();
- MimeMultipart mp = verify(this.getClass().getName() + " - " + msg2);
+ MimeMultipart mp = verifyAndExtractMimeMultipart("testCustomEvaluator " + this.getClass().getName() + " - " + msg2);
String body = GreenMailUtil.getBody(mp.getBodyPart(0));
- assertEquals("helloworld", body);
+ assertEquals("testCustomEvaluator", body);
}
@Test
@@ -269,31 +288,35 @@ public class SMTPAppender_GreenTest {
String msg = "hello";
logger.error(msg);
waitUntilEmailIsSent();
- MimeMultipart mp = verify(this.getClass().getName() + " - " + msg);
+ MimeMultipart mp = verifyAndExtractMimeMultipart("testCustomBufferSize " + this.getClass().getName() + " - " + msg);
String body = GreenMailUtil.getBody(mp.getBodyPart(0));
assertEquals(msg, body);
}
+ // this test fails intermittently on Jenkins.
@Test
public void testMultipleTo() throws Exception {
- buildSMTPAppender(SYNCHRONOUS);
- smtpAppender.setLayout(buildPatternLayout(lc, DEFAULT_PATTERN));
+ buildSMTPAppender("testMultipleTo", SYNCHRONOUS);
+ smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN));
+ // buildSMTPAppender() already added one destination address
smtpAppender.addTo("Test , other-test@example.com");
smtpAppender.start();
logger.addAppender(smtpAppender);
- logger.debug("hello");
- logger.error("en error", new Exception("an exception"));
-
+ logger.debug("testMultipleTo hello");
+ logger.error("testMultipleTo en error", new Exception("an exception"));
+ Thread.yield();
+ int expectedEmailCount = 3;
+ waitForServerToReceiveEmails(expectedEmailCount);
MimeMessage[] mma = greenMailServer.getReceivedMessages();
assertNotNull(mma);
- assertEquals(oldCount+3, mma.length);
+ assertEquals(expectedEmailCount, mma.length);
}
// http://jira.qos.ch/browse/LBCLASSIC-221
@Test
public void bufferShouldBeResetBetweenMessages() throws Exception {
- buildSMTPAppender(SYNCHRONOUS);
- smtpAppender.setLayout(buildPatternLayout(lc, DEFAULT_PATTERN));
+ buildSMTPAppender("bufferShouldBeResetBetweenMessages", SYNCHRONOUS);
+ smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN));
smtpAppender.start();
logger.addAppender(smtpAppender);
String msg0 = "hello zero";
@@ -304,17 +327,20 @@ public class SMTPAppender_GreenTest {
logger.debug(msg1);
logger.error("error one");
- waitUntilEmailIsSent();
+ Thread.yield();
+ int oldCount = 0;
+ int expectedEmailCount = oldCount + 2;
+ waitForServerToReceiveEmails(expectedEmailCount);
MimeMessage[] mma = greenMailServer.getReceivedMessages();
assertNotNull(mma);
- assertEquals(oldCount+2, mma.length);
+ assertEquals(expectedEmailCount, mma.length);
MimeMessage mm0 = mma[oldCount];
MimeMultipart content0 = (MimeMultipart) mm0.getContent();
String body0 = GreenMailUtil.getBody(content0.getBodyPart(0));
- MimeMessage mm1 = mma[oldCount+1];
+ MimeMessage mm1 = mma[oldCount + 1];
MimeMultipart content1 = (MimeMultipart) mm1.getContent();
String body1 = GreenMailUtil.getBody(content1.getBodyPart(0));
// second body should not contain content from first message
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_SubethaSMTPTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_SubethaSMTPTest.java
index 1d671c421920edfc92a4058692f6476297a3f06c..cc01494c30763f06ffc52a9c8c6d7c838f694100 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_SubethaSMTPTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_SubethaSMTPTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SSLSocketRemoteTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SSLSocketReceiverTest.java
similarity index 66%
rename from logback-classic/src/test/java/ch/qos/logback/classic/net/SSLSocketRemoteTest.java
rename to logback-classic/src/test/java/ch/qos/logback/classic/net/SSLSocketReceiverTest.java
index aae7c407b8a8034269a3f1a180667791df899f98..36d5a2e2893e7d599e2d8c4026cddad16e0c63e1 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SSLSocketRemoteTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SSLSocketReceiverTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,7 +11,6 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.classic.net;
import static org.junit.Assert.assertNotNull;
@@ -20,30 +19,30 @@ import java.net.InetAddress;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.LoggerFactory;
-import ch.qos.logback.core.net.mock.MockContext;
+import ch.qos.logback.classic.LoggerContext;
/**
- * Unit tests for {@link SSLSocketRemote}.
+ * Unit tests for {@link SSLSocketReceiver}.
*
* @author Carl Harris
*/
-public class SSLSocketRemoteTest {
-
- private MockContext context = new MockContext();
+public class SSLSocketReceiverTest {
- private SSLSocketRemote remote =
- new SSLSocketRemote();
+ private SSLSocketReceiver remote =
+ new SSLSocketReceiver();
@Before
public void setUp() throws Exception {
- remote.setContext(context);
+ LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
+ remote.setContext(lc);
}
@Test
public void testUsingDefaultConfig() throws Exception {
// should be able to start successfully with no SSL configuration at all
- remote.setHost(InetAddress.getLocalHost().getHostAddress());
+ remote.setRemoteHost(InetAddress.getLocalHost().getHostAddress());
remote.setPort(6000);
remote.start();
assertNotNull(remote.getSocketFactory());
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SerializationPerfTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SerializationPerfTest.java
index 8064a34cca05016b5a55889ccf615d5ef61a5907..6760da46734290af7996518052c66e751b833341 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SerializationPerfTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SerializationPerfTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderTest.java
deleted file mode 100644
index 9a45a6e16670484d6b9b716dcc94d5b0b06526f6..0000000000000000000000000000000000000000
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderTest.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, 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.classic.net;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.concurrent.*;
-
-import ch.qos.logback.core.status.OnConsoleStatusListener;
-import ch.qos.logback.core.testUtil.RandomUtil;
-import org.junit.*;
-import org.slf4j.MDC;
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.classic.spi.LoggerContextVO;
-import ch.qos.logback.core.read.ListAppender;
-
-import static org.junit.Assert.*;
-
-public class SocketAppenderTest {
-
- static final String LIST_APPENDER_NAME = "list";
- static final int RECONNECT_DELAY = 1;
- static final int SERVER_LATCH_WAIT_TIMEOUT = 1000;
- static final int APPENDER_LATCH_WAIT_TIMEOUT = 10;
-
- static int diff = RandomUtil.getPositiveInt();
-
- static int PORT = 1024 + (diff % 30000);
- static LoggerContext SERVER_LOGGER_CONTEXT = new LoggerContext();
- static ListAppenderWithLatch LIST_APPENDER = new ListAppenderWithLatch();
- static private SimpleSocketServer SIMPLE_SOCKET_SERVER;
-
- String mdcKey = "key" + diff;
- LoggerContext loggerContext = new LoggerContext();
- SocketAppender socketAppender = new SocketAppender();
- private boolean includeCallerData = false;
-
- @BeforeClass
- public static void beforeClass() throws InterruptedException {
- fireServer();
- waitForServerToStart();
- }
-
- @AfterClass
- public static void afterClass() {
- closeServer();
- }
-
- private static void closeServer() {SIMPLE_SOCKET_SERVER.close();}
-
- @Before
- public void setUp() {
- }
-
- @After
- public void tearDown() {
- LIST_APPENDER.list.clear();
- }
-
- @Test
- public void startFailNoRemoteHost() {
- SocketAppender appender = new SocketAppender();
- appender.setContext(loggerContext);
- appender.setPort(PORT);
- appender.start();
- assertEquals(1, loggerContext.getStatusManager().getCount());
- }
-
- @Test
- public void receiveMessage() throws InterruptedException {
- updateListAppenderLatch(1);
- configureClient();
-
- Logger logger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
- logger.debug("test msg");
-
- waitForListAppenderLatch();
-
- //simpleSocketServer.close();
- //simpleSocketServer.join(JOIN_OR_WAIT_TIMEOUT);
- //assertTrue(simpleSocketServer.isClosed());
- assertEquals(1, LIST_APPENDER.list.size());
-
- ILoggingEvent remoteEvent = LIST_APPENDER.list.get(0);
- assertNull(remoteEvent.getCallerData());
- assertEquals("test msg", remoteEvent.getMessage());
- assertEquals(Level.DEBUG, remoteEvent.getLevel());
- }
-
- @Test
- public void receiveWithContext() throws InterruptedException {
- updateListAppenderLatch(1);
- configureClient();
-
- Logger logger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
- logger.debug("test msg");
- waitForListAppenderLatch();
-
- assertEquals(1, LIST_APPENDER.list.size());
-
- ILoggingEvent remoteEvent = LIST_APPENDER.list.get(0);
-
- String loggerName = remoteEvent.getLoggerName();
- assertNotNull(loggerName);
- assertEquals(Logger.ROOT_LOGGER_NAME, loggerName);
-
- LoggerContextVO loggerContextRemoteView = remoteEvent
- .getLoggerContextVO();
- assertNull(remoteEvent.getCallerData());
- assertNotNull(loggerContextRemoteView);
- assertEquals("test", loggerContextRemoteView.getName());
- Map props = loggerContextRemoteView.getPropertyMap();
- assertEquals("testValue", props.get("testKey"));
- }
-
- @Test
- public void messageWithMDC() throws InterruptedException {
- updateListAppenderLatch(1);
- configureClient();
-
- Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
-
- MDC.put(mdcKey, "testValue");
- root.debug("test msg");
-
- waitForListAppenderLatch();
- assertEquals(1, LIST_APPENDER.list.size());
-
- ILoggingEvent remoteEvent = LIST_APPENDER.list.get(0);
- Map MDCPropertyMap = remoteEvent.getMDCPropertyMap();
- assertEquals("testValue", MDCPropertyMap.get(mdcKey));
- assertNull(remoteEvent.getCallerData());
- }
-
- // test http://jira.qos.ch/browse/LBCLASSIC-145
- @Test
- public void withCallerData() throws InterruptedException {
- updateListAppenderLatch(1);
- includeCallerData = true;
-// fireServer();
-// waitForServerToStart();
- configureClient();
-
- Logger logger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
- logger.debug("test msg");
-
- waitForListAppenderLatch();
- assertEquals(1, LIST_APPENDER.list.size());
-
- ILoggingEvent remoteEvent = LIST_APPENDER.list.get(0);
- assertNotNull(remoteEvent.getCallerData());
- }
-
- @Test
- public void messageWithMarker() throws InterruptedException {
- updateListAppenderLatch(1);
- configureClient();
-
- Logger logger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
-
- Marker marker = MarkerFactory.getMarker("testMarker");
- logger.debug(marker, "test msg");
- waitForListAppenderLatch();
-
- assertEquals(1, LIST_APPENDER.list.size());
-
- ILoggingEvent remoteEvent = LIST_APPENDER.list.get(0);
- assertEquals("testMarker", remoteEvent.getMarker().getName());
- }
-
- @Test
- public void messageWithUpdatedMDC() throws InterruptedException {
- updateListAppenderLatch(2);
- configureClient();
-
- Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
-
- MDC.put(mdcKey, "testValue");
- root.debug("test msg");
-
- MDC.put(mdcKey, "updatedTestValue");
- root.debug("test msg 2");
-
- waitForListAppenderLatch();
- assertEquals(2, LIST_APPENDER.list.size());
-
- // We observe the second logging event. It should provide us with
- // the updated MDC property.
- ILoggingEvent remoteEvent = LIST_APPENDER.list.get(1);
- Map MDCPropertyMap = remoteEvent.getMDCPropertyMap();
- assertEquals("updatedTestValue", MDCPropertyMap.get(mdcKey));
- }
-
- @Test
- public void lateServerLaunch() throws InterruptedException {
- closeServer();
-
- socketAppender.setReconnectionDelay(RECONNECT_DELAY);
- configureClient();
- OnConsoleStatusListener.addNewInstanceToContext(loggerContext);
-
- Logger logger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
- logger.debug("test msg");
-
- fireServer();
- waitForServerToStart();
- updateListAppenderLatch(1);
-
-
- int len = 1000/APPENDER_LATCH_WAIT_TIMEOUT;
- for(int i = 0; i < len; i++) {
- logger.debug("test msg lateServerLaunch");
- if(waitForListAppenderLatch()) {
- System.out.println("Success after "+i+" attempts");
- break;
- }
- }
-
- assertTrue("expecting non-empty list", LIST_APPENDER.list.size() > 0);
-
- ILoggingEvent remoteEvent = LIST_APPENDER.list.get(0);
- assertEquals("test msg lateServerLaunch", remoteEvent.getMessage());
- assertEquals(Level.DEBUG, remoteEvent.getLevel());
- }
-
- private static void waitForServerToStart() throws InterruptedException {
- CountDownLatch latch = SIMPLE_SOCKET_SERVER.getLatch();
- boolean success = latch.await(SERVER_LATCH_WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
- if (!success) {
- fail("Failed latch wait for server to start");
- }
- }
-
- private static void fireServer() throws InterruptedException {
- SERVER_LOGGER_CONTEXT.reset();
-
- Logger root = SERVER_LOGGER_CONTEXT.getLogger("root");
-
- // we don't want to ignore messages generated by SocketNode
- Logger socketNodeLogger = SERVER_LOGGER_CONTEXT.getLogger(SocketNode.class);
- socketNodeLogger.setLevel(Level.WARN);
-
- LIST_APPENDER.setName(LIST_APPENDER_NAME);
- LIST_APPENDER.setContext(SERVER_LOGGER_CONTEXT);
- LIST_APPENDER.start();
-
- root.addAppender(LIST_APPENDER);
- SIMPLE_SOCKET_SERVER = new SimpleSocketServer(SERVER_LOGGER_CONTEXT, PORT);
- CountDownLatch latch = new CountDownLatch(1);
- SIMPLE_SOCKET_SERVER.setLatch(latch);
- SIMPLE_SOCKET_SERVER.start();
- }
-
- private void updateListAppenderLatch(int count) {
- LIST_APPENDER.setLatch(new CountDownLatch(count));
- }
-
- private boolean waitForListAppenderLatch() throws InterruptedException {
- CountDownLatch latch = LIST_APPENDER.getLatch();
- boolean success = latch.await(APPENDER_LATCH_WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
- return success;
- }
-
- private void configureClient() {
- loggerContext = new LoggerContext();
- loggerContext.setName("test");
- loggerContext.putProperty("testKey", "testValue");
- Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
- socketAppender.setContext(loggerContext);
- socketAppender.setName("socket");
- socketAppender.setPort(PORT);
- socketAppender.setRemoteHost("localhost");
- socketAppender.setIncludeCallerData(includeCallerData);
- root.addAppender(socketAppender);
- socketAppender.start();
- }
-
- public static class ListAppenderWithLatch extends ListAppender {
-
- CountDownLatch latch;
-
- public void setLatch(CountDownLatch latch) {
- this.latch = latch;
- }
-
- CountDownLatch getLatch() {
- return latch;
- }
-
- protected void append(E event) {
- super.append(event);
- try {
- latch.countDown();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
-}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketMin.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketMin.java
index 9a13386126b496bb9ed015536f3e6cf7f1c8fc01..1edc92abad161aa2daad4c606ae985bdd867debb 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketMin.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketMin.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -56,7 +56,9 @@ public class SocketMin {
try {
int port = Integer.parseInt(portStr);
logger.info("Creating socket appender (" + host + "," + port + ").");
- s = new SocketAppender(host, port);
+ s = new SocketAppender();
+ s.setRemoteHost(host);
+ s.setPort(port);
s.setName("S");
root.addAppender(s);
} catch (java.lang.NumberFormatException e) {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketRemoteTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketReceiverTest.java
similarity index 69%
rename from logback-classic/src/test/java/ch/qos/logback/classic/net/SocketRemoteTest.java
rename to logback-classic/src/test/java/ch/qos/logback/classic/net/SocketReceiverTest.java
index fb54bba5632f7532321ce09289d1897bf4b3d562..b4fcaa1f8710becfc636de709f84e764bbda78e1 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketRemoteTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketReceiverTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,7 +11,6 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.classic.net;
import static org.junit.Assert.assertEquals;
@@ -27,7 +26,6 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import javax.net.SocketFactory;
@@ -35,7 +33,6 @@ import javax.net.SocketFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
@@ -45,32 +42,30 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.classic.spi.LoggingEventVO;
import ch.qos.logback.core.net.SocketConnector;
-import ch.qos.logback.core.net.mock.MockContext;
import ch.qos.logback.core.net.server.ServerSocketUtil;
+import ch.qos.logback.core.status.Status;
/**
- * Unit tests for {@link SocketRemote}.
+ * Unit tests for {@link SocketReceiver}.
*
* @author Carl Harris
*/
-public class SocketRemoteTest {
+public class SocketReceiverTest {
- private static final int DELAY = 200;
+ private static final int DELAY = 1000;
private static final String TEST_HOST_NAME = "NOT.A.VALID.HOST.NAME";
private ServerSocket serverSocket;
private Socket socket;
- private ExecutorService executor = Executors.newCachedThreadPool();
- private MockContext context = new MockContext();
private MockSocketFactory socketFactory = new MockSocketFactory();
private MockSocketConnector connector;
private MockAppender appender;
private LoggerContext lc;
private Logger logger;
- private InstrumentedSocketRemote remote =
- new InstrumentedSocketRemote();
+ private InstrumentedSocketReceiver receiver =
+ new InstrumentedSocketReceiver();
@Before
public void setUp() throws Exception {
@@ -78,9 +73,10 @@ public class SocketRemoteTest {
socket = new Socket(serverSocket.getInetAddress(),
serverSocket.getLocalPort());
connector = new MockSocketConnector(socket);
- remote.setContext(context);
- lc = (LoggerContext) LoggerFactory.getILoggerFactory();
+ lc = new LoggerContext();
+ lc.reset();
+ receiver.setContext(lc);
appender = new MockAppender();
appender.start();
logger = lc.getLogger(getClass());
@@ -89,10 +85,9 @@ public class SocketRemoteTest {
@After
public void tearDown() throws Exception {
- remote.stop();
- if (!remote.isExecutorCreated()) {
- executor.shutdownNow();
- }
+ receiver.stop();
+ ExecutorService executor = lc.getExecutorService();
+ executor.shutdownNow();
assertTrue(executor.awaitTermination(DELAY, TimeUnit.MILLISECONDS));
socket.close();
serverSocket.close();
@@ -101,64 +96,73 @@ public class SocketRemoteTest {
@Test
public void testStartNoRemoteAddress() throws Exception {
- remote.start();
- assertTrue(context.getLastStatus().getMessage().contains("host"));
+ receiver.start();
+ assertFalse(receiver.isStarted());
+ int count = lc.getStatusManager().getCount();
+ Status status = lc.getStatusManager().getCopyOfStatusList().get(count - 1);
+ assertTrue(status.getMessage().contains("host"));
}
@Test
public void testStartNoPort() throws Exception {
- remote.setHost(TEST_HOST_NAME);
- remote.start();
- assertTrue(context.getLastStatus().getMessage().contains("port"));
+ receiver.setRemoteHost(TEST_HOST_NAME);
+ receiver.start();
+ assertFalse(receiver.isStarted());
+ int count = lc.getStatusManager().getCount();
+ Status status = lc.getStatusManager().getCopyOfStatusList().get(count - 1);
+ assertTrue(status.getMessage().contains("port"));
}
@Test
public void testStartUnknownHost() throws Exception {
- remote.setPort(6000);
- remote.setHost(TEST_HOST_NAME);
- remote.start();
- assertTrue(context.getLastStatus().getMessage().contains("unknown host"));
+ receiver.setPort(6000);
+ receiver.setRemoteHost(TEST_HOST_NAME);
+ receiver.start();
+ assertFalse(receiver.isStarted());
+ int count = lc.getStatusManager().getCount();
+ Status status = lc.getStatusManager().getCopyOfStatusList().get(count - 1);
+ assertTrue(status.getMessage().contains("unknown host"));
}
@Test
public void testStartStop() throws Exception {
- remote.setHost(InetAddress.getLocalHost().getHostName());
- remote.setPort(6000);
- remote.setAcceptConnectionTimeout(DELAY / 2);
- remote.start();
- assertTrue(remote.isStarted());
- remote.awaitConnectorCreated(DELAY);
- remote.stop();
- assertFalse(remote.isStarted());
+ receiver.setRemoteHost(InetAddress.getLocalHost().getHostName());
+ receiver.setPort(6000);
+ receiver.setAcceptConnectionTimeout(DELAY / 2);
+ receiver.start();
+ assertTrue(receiver.isStarted());
+ receiver.awaitConnectorCreated(DELAY);
+ receiver.stop();
+ assertFalse(receiver.isStarted());
}
@Test
public void testServerSlowToAcceptConnection() throws Exception {
- remote.setHost(InetAddress.getLocalHost().getHostName());
- remote.setPort(6000);
- remote.setAcceptConnectionTimeout(DELAY / 4);
- remote.start();
- assertTrue(remote.awaitConnectorCreated(DELAY / 2));
+ receiver.setRemoteHost(InetAddress.getLocalHost().getHostName());
+ receiver.setPort(6000);
+ receiver.setAcceptConnectionTimeout(DELAY / 4);
+ receiver.start();
+ assertTrue(receiver.awaitConnectorCreated(DELAY / 2));
// note that we don't call serverSocket.accept() here
- // but stop (in tearDown) should still clean up everything
+ // but processPriorToRemoval (in tearDown) should still clean up everything
}
@Test
public void testServerDropsConnection() throws Exception {
- remote.setHost(InetAddress.getLocalHost().getHostName());
- remote.setPort(6000);
- remote.start();
- assertTrue(remote.awaitConnectorCreated(DELAY));
+ receiver.setRemoteHost(InetAddress.getLocalHost().getHostName());
+ receiver.setPort(6000);
+ receiver.start();
+ assertTrue(receiver.awaitConnectorCreated(DELAY));
Socket socket = serverSocket.accept();
socket.close();
}
@Test
public void testDispatchEventForEnabledLevel() throws Exception {
- remote.setHost(InetAddress.getLocalHost().getHostName());
- remote.setPort(6000);
- remote.start();
- assertTrue(remote.awaitConnectorCreated(DELAY));
+ receiver.setRemoteHost(InetAddress.getLocalHost().getHostName());
+ receiver.setPort(6000);
+ receiver.start();
+ assertTrue(receiver.awaitConnectorCreated(DELAY));
Socket socket = serverSocket.accept();
ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
@@ -180,10 +184,10 @@ public class SocketRemoteTest {
@Test
public void testNoDispatchEventForDisabledLevel() throws Exception {
- remote.setHost(InetAddress.getLocalHost().getHostName());
- remote.setPort(6000);
- remote.start();
- assertTrue(remote.awaitConnectorCreated(DELAY));
+ receiver.setRemoteHost(InetAddress.getLocalHost().getHostName());
+ receiver.setPort(6000);
+ receiver.start();
+ assertTrue(receiver.awaitConnectorCreated(DELAY));
Socket socket = serverSocket.accept();
ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
@@ -200,12 +204,11 @@ public class SocketRemoteTest {
}
/**
- * A {@link SocketRemote} with instrumentation for unit testing.
+ * A {@link SocketReceiver} with instrumentation for unit testing.
*/
- private class InstrumentedSocketRemote extends SocketRemote {
+ private class InstrumentedSocketReceiver extends SocketReceiver {
private boolean connectorCreated;
- private boolean executorCreated;
@Override
protected synchronized SocketConnector newConnector(
@@ -220,11 +223,6 @@ public class SocketRemoteTest {
return socketFactory;
}
- @Override
- protected ExecutorService createExecutorService() {
- return executor;
- }
-
public synchronized boolean awaitConnectorCreated(long delay)
throws InterruptedException {
while (!connectorCreated) {
@@ -233,10 +231,6 @@ public class SocketRemoteTest {
return connectorCreated;
}
- public boolean isExecutorCreated() {
- return executorCreated;
- }
-
}
/**
@@ -250,14 +244,7 @@ public class SocketRemoteTest {
this.socket = socket;
}
- public void run() {
- }
-
- public Socket awaitConnection() throws InterruptedException {
- return awaitConnection(Long.MAX_VALUE);
- }
-
- public Socket awaitConnection(long delay) throws InterruptedException {
+ public Socket call() throws InterruptedException {
return socket;
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java
index 3b199c12c6bf15ac8d3ab1e114f63d940821e673..cf4da4a3770bbabc677b1a0ac439ec81d07d52b5 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -183,7 +183,7 @@ public class SyslogAppenderTest {
@Test
public void large() throws InterruptedException {
- setMockServerAndConfigure(1);
+ setMockServerAndConfigure(2);
StringBuilder largeBuf = new StringBuilder();
for (int i = 0; i < 2 * 1024 * 1024; i++) {
largeBuf.append('a');
@@ -197,15 +197,24 @@ public class SyslogAppenderTest {
mockServer.join(8000);
assertTrue(mockServer.isFinished());
-
- // the first message is wasted
- assertEquals(1, mockServer.getMessageList().size());
- String msg = mockServer.getMessageList().get(0);
- String expected = "<"
+
+ // both messages received
+ assertEquals(2, mockServer.getMessageList().size());
+
+ String expected = "<"
+ (SyslogConstants.LOG_MAIL + SyslogConstants.DEBUG_SEVERITY) + ">";
- assertTrue(msg.startsWith(expected));
String expectedPrefix = "<\\d{2}>\\w{3} \\d{2} \\d{2}(:\\d{2}){2} [\\w.-]* ";
String threadName = Thread.currentThread().getName();
+
+ // large message is truncated
+ String largeMsg = mockServer.getMessageList().get(0);
+ assertTrue(largeMsg.startsWith(expected));
+ String largeRegex = expectedPrefix + "\\[" + threadName + "\\] " + loggerName
+ + " " + "a{64000,66000}";
+ checkRegexMatch(largeMsg, largeRegex);
+
+ String msg = mockServer.getMessageList().get(1);
+ assertTrue(msg.startsWith(expected));
String regex = expectedPrefix + "\\[" + threadName + "\\] " + loggerName
+ " " + logMsg;
checkRegexMatch(msg, regex);
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockAppender.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockAppender.java
index d9159698453469af3c156b966fc4821d648ce907..66e46afab6f3d92d505452b501dfc353ca001f44 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockAppender.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockObjectMessage.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockObjectMessage.java
index 2bd903dc1996f14098cc2f54df670c0f171ec68e..bdcc36e0467477970919315a8b503ed9b28e871e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockObjectMessage.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockObjectMessage.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java
index fefdca832ab015817e3b2fb3dedeb08349385fd4..f7648fb11c215dd8017f65612971124f867e8723 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java
index e6458f156bb8d0d73361767d1b3f208666379397..b3850770015b7fb7140e1bbaceff586171d7d9b9 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java
index 589026b6eb323ce296df342f430776d5788b22cf..96aba7d605f21e41e7ab3e6979cf12da5b17a4a6 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java
index 7ff1019cc4d4fa3803c525e78908982152a805d3..fdee3e054b0a357e9a39bb90f6b39237f2aa1700 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java
index 1e97dcf80a144ee8f55fd6ecb58bac9ac3810c00..139b3636b793eac308641906801af5a23fa8466a 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockSyslogServer.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockSyslogServer.java
index a0bd6a64f34ac35b0a4ebe841be2aaf1e2204904..a74f84b0a33005c282c615e91ab678e5c2c49e8e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockSyslogServer.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockSyslogServer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -44,7 +44,7 @@ public class MockSyslogServer extends Thread {
socket = new DatagramSocket(port);
for (int i = 0; i < loopLen; i++) {
- byte[] buf = new byte[2048];
+ byte[] buf = new byte[65536];
DatagramPacket packet = new DatagramPacket(buf, buf.length);
//System.out.println("Waiting for message");
socket.receive(packet);
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopic.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopic.java
index 4a46555a29ffd9efa556a144d282a89102f423fc..cfffd8f6ed4d4eb8d6c759742c962f38ee2beba3 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopic.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopic.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnection.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnection.java
index 4c0addaa6f1a3d96ccee7efa7bdf536afb066b52..92dc5df4a4be89f481b4e862860d6e55e7dc64ae 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnection.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnection.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnectionFactory.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnectionFactory.java
index eb01d86425076607ad54dc446992334df0bdbec9..b8e4ca596e1a02e1a87d9b0f9640cd5e7595fb15 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnectionFactory.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnectionFactory.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicPublisher.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicPublisher.java
index 89e2bfd1a89969ac213585aea08baba67aad2c57..106b121050e41037b86c8eaa744af428666d914c 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicPublisher.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicPublisher.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicSession.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicSession.java
index cbb0688da91befaf57f4cd23a9797a64c3f12215..83146efc6ef7920c6ace67ca727846d5e236e2ef 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicSession.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicSession.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/InstrumentedSocketServer.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/InstrumentedServerSocketReceiver.java
similarity index 85%
rename from logback-classic/src/test/java/ch/qos/logback/classic/net/server/InstrumentedSocketServer.java
rename to logback-classic/src/test/java/ch/qos/logback/classic/net/server/InstrumentedServerSocketReceiver.java
index 895d390133cf88354b9385464ec5da39f6797435..f61d0f7fb8f74636e7d2b529da7c49eaedb26f30 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/InstrumentedSocketServer.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/InstrumentedServerSocketReceiver.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -22,17 +22,17 @@ import javax.net.ServerSocketFactory;
import ch.qos.logback.classic.net.server.RemoteAppenderClient;
import ch.qos.logback.classic.net.server.RemoteAppenderServerListener;
-import ch.qos.logback.classic.net.server.SocketServer;
+import ch.qos.logback.classic.net.server.ServerSocketReceiver;
import ch.qos.logback.core.net.server.ServerListener;
import ch.qos.logback.core.net.server.ServerRunner;
/**
- * A {@link SocketServer} with instrumentation for unit testing.
+ * A {@link ServerSocketReceiver} with instrumentation for unit testing.
*
* @author Carl Harris
*/
-public class InstrumentedSocketServer extends SocketServer {
+public class InstrumentedServerSocketReceiver extends ServerSocketReceiver {
private final ServerSocket serverSocket;
private final ServerListener listener;
@@ -40,11 +40,11 @@ public class InstrumentedSocketServer extends SocketServer {
private ServerListener lastListener;
- public InstrumentedSocketServer(ServerSocket serverSocket) {
+ public InstrumentedServerSocketReceiver(ServerSocket serverSocket) {
this(serverSocket, new RemoteAppenderServerListener(serverSocket), null);
}
- public InstrumentedSocketServer(ServerSocket serverSocket,
+ public InstrumentedServerSocketReceiver(ServerSocket serverSocket,
ServerListener listener,
ServerRunner runner) {
this.serverSocket = serverSocket;
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockSSLConfiguration.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockSSLConfiguration.java
index 8c7a1813adb7e2e8955e5cfd419e4b1d2f8a5df1..537c0ff59212e28fb46141dea30daf443bc561aa 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockSSLConfiguration.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockSSLConfiguration.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockSSLParametersConfiguration.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockSSLParametersConfiguration.java
index 6e0e13f5e9255413b212cffe583f8bd88115de7b..dc1e08fe580981169aef22fc780e84596fe4341e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockSSLParametersConfiguration.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockSSLParametersConfiguration.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockThreadPoolFactoryBean.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockThreadPoolFactoryBean.java
deleted file mode 100644
index 007331220bae6dea60af0641ff886e35ba666425..0000000000000000000000000000000000000000
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/MockThreadPoolFactoryBean.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, 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.classic.net.server;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.AbstractExecutorService;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import ch.qos.logback.core.net.server.ThreadPoolFactoryBean;
-
-/**
- * A mock {@link ThreadPoolFactoryBean} with instrumentation for unit testing.
- *
- * @author Carl Harris
- */
-class MockThreadPoolFactoryBean extends ThreadPoolFactoryBean {
-
- private final MockExecutorService executorService =
- new MockExecutorService();
-
- private Runnable lastCommand;
-
- @Override
- public ExecutorService createExecutor() {
- return executorService;
- }
-
- public Runnable getLastCommand() {
- return lastCommand;
- }
-
- private class MockExecutorService extends AbstractExecutorService {
-
- public void shutdown() {
- }
-
- public List shutdownNow() {
- return Collections.emptyList();
- }
-
- public boolean isShutdown() {
- return true;
- }
-
- public boolean isTerminated() {
- return true;
- }
-
- public boolean awaitTermination(long timeout, TimeUnit unit)
- throws InterruptedException {
- return true;
- }
-
- public void execute(Runnable command) {
- lastCommand = command;
- }
-
- }
-
-}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClientTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClientTest.java
index 78718cb3bbf9b830050b470f24fd2861faf07c64..21ba3418ee9a93beb18ba0251a7fba0489770dba 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClientTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClientTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/SSLSocketServerTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/SSLServerSocketReceiverTest.java
similarity index 74%
rename from logback-classic/src/test/java/ch/qos/logback/classic/net/server/SSLSocketServerTest.java
rename to logback-classic/src/test/java/ch/qos/logback/classic/net/server/SSLServerSocketReceiverTest.java
index 1fba4a0fa01fac9108e3728b470b629800eed993..2d273638cec4ede0bec8f862ef60e4daaf29efa0 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/SSLSocketServerTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/SSLServerSocketReceiverTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -21,14 +21,14 @@ import javax.net.ServerSocketFactory;
import org.junit.Before;
import org.junit.Test;
-import ch.qos.logback.core.net.server.MockContext;
+import ch.qos.logback.core.net.mock.MockContext;
/**
- * Unit tests for {@link SSLSocketServer}.
+ * Unit tests for {@link SSLServerSocketReceiver}.
*
* @author Carl Harris
*/
-public class SSLSocketServerTest {
+public class SSLServerSocketReceiverTest {
private MockContext context = new MockContext();
@@ -37,18 +37,18 @@ public class SSLSocketServerTest {
private MockSSLParametersConfiguration parameters =
new MockSSLParametersConfiguration();
- private SSLSocketServer socketServer = new SSLSocketServer();
+ private SSLServerSocketReceiver receiver = new SSLServerSocketReceiver();
@Before
public void setUp() throws Exception {
- socketServer.setContext(context);
- socketServer.setSsl(ssl);
+ receiver.setContext(context);
+ receiver.setSsl(ssl);
ssl.setParameters(parameters);
}
@Test
public void testGetServerSocketFactory() throws Exception {
- ServerSocketFactory socketFactory = socketServer.getServerSocketFactory();
+ ServerSocketFactory socketFactory = receiver.getServerSocketFactory();
assertNotNull(socketFactory);
assertTrue(ssl.isContextCreated());
assertTrue(parameters.isContextInjected());
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/SocketServerFunctionalTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/ServerSocketReceiverFunctionalTest.java
similarity index 79%
rename from logback-classic/src/test/java/ch/qos/logback/classic/net/server/SocketServerFunctionalTest.java
rename to logback-classic/src/test/java/ch/qos/logback/classic/net/server/ServerSocketReceiverFunctionalTest.java
index 182eeb48d2a20ca747618a3c34d52ab7351bc735..b8135d4b44984c1b5bcdbe3c5cac465ae305ac24 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/SocketServerFunctionalTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/ServerSocketReceiverFunctionalTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -22,13 +22,11 @@ import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
@@ -38,16 +36,15 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.classic.spi.LoggingEventVO;
import ch.qos.logback.core.net.server.ServerSocketUtil;
-import ch.qos.logback.core.net.server.ThreadPoolFactoryBean;
/**
- * A functional test for {@link SocketServer}.
+ * A functional test for {@link ServerSocketReceiver}.
*
* In this test we create a SocketServer, connect to it over the local
* network interface, and validate that it receives messages and delivers
* them to its appender.
*/
-public class SocketServerFunctionalTest {
+public class ServerSocketReceiverFunctionalTest {
private static final int EVENT_COUNT = 10;
private static final int SHUTDOWN_DELAY = 10000;
@@ -55,12 +52,12 @@ public class SocketServerFunctionalTest {
private MockAppender appender;
private Logger logger;
private ServerSocket serverSocket;
- private ExecutorService executor = Executors.newFixedThreadPool(2);
- private InstrumentedSocketServer socketServer;
+ private InstrumentedServerSocketReceiver receiver;
+ private LoggerContext lc;
@Before
public void setUp() throws Exception {
- LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
+ lc = new LoggerContext();
appender = new MockAppender();
appender.start();
@@ -70,21 +67,17 @@ public class SocketServerFunctionalTest {
serverSocket = ServerSocketUtil.createServerSocket();
- socketServer = new InstrumentedSocketServer(serverSocket);
-
- socketServer.setThreadPool(new ThreadPoolFactoryBean() {
- @Override
- public ExecutorService createExecutor() {
- return executor;
- }
- });
-
- socketServer.setContext(lc);
+ receiver = new InstrumentedServerSocketReceiver(serverSocket);
+
+ receiver.setContext(lc);
+ receiver.start();
}
@After
public void tearDown() throws Exception {
- socketServer.stop();
+ receiver.stop();
+ ExecutorService executor = lc.getExecutorService();
+ executor.shutdownNow();
executor.awaitTermination(SHUTDOWN_DELAY, TimeUnit.MILLISECONDS);
assertTrue(executor.isTerminated());
}
@@ -93,7 +86,6 @@ public class SocketServerFunctionalTest {
public void testLogEventFromClient() throws Exception {
ILoggingEvent event = new LoggingEvent(logger.getName(), logger,
Level.DEBUG, "test message", null, new Object[0]);
- socketServer.start();
Socket socket = new Socket(InetAddress.getLocalHost(),
serverSocket.getLocalPort());
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/SocketServerTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/ServerSocketReceiverTest.java
similarity index 64%
rename from logback-classic/src/test/java/ch/qos/logback/classic/net/server/SocketServerTest.java
rename to logback-classic/src/test/java/ch/qos/logback/classic/net/server/ServerSocketReceiverTest.java
index d870cb7273e7f5e61349ca8c08ea1d80d47a91e7..4fc7bc4413da93ca4018abcabf42a967a575eb35 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/server/SocketServerTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/server/ServerSocketReceiverTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -26,7 +26,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import ch.qos.logback.core.net.server.MockContext;
+import ch.qos.logback.core.net.mock.MockContext;
import ch.qos.logback.core.net.server.MockServerListener;
import ch.qos.logback.core.net.server.MockServerRunner;
import ch.qos.logback.core.net.server.ServerSocketUtil;
@@ -34,11 +34,11 @@ import ch.qos.logback.core.status.ErrorStatus;
import ch.qos.logback.core.status.Status;
/**
- * Unit tests for {@link SocketServer}.
+ * Unit tests for {@link ServerSocketReceiver}.
*
* @author Carl Harris
*/
-public class SocketServerTest {
+public class ServerSocketReceiverTest {
private MockContext context = new MockContext();
@@ -48,18 +48,14 @@ public class SocketServerTest {
private MockServerListener listener =
new MockServerListener();
- private MockThreadPoolFactoryBean threadPool =
- new MockThreadPoolFactoryBean();
-
private ServerSocket serverSocket;
- private InstrumentedSocketServer socketServer;
+ private InstrumentedServerSocketReceiver receiver;
@Before
public void setUp() throws Exception {
serverSocket = ServerSocketUtil.createServerSocket();
- socketServer = new InstrumentedSocketServer(serverSocket, listener, runner);
- socketServer.setThreadPool(threadPool);
- socketServer.setContext(context);
+ receiver = new InstrumentedServerSocketReceiver(serverSocket, listener, runner);
+ receiver.setContext(context);
}
@After
@@ -69,42 +65,29 @@ public class SocketServerTest {
@Test
public void testStartStop() throws Exception {
- socketServer.start();
+ receiver.start();
assertTrue(runner.isContextInjected());
- assertTrue(runner.isStarted());
- assertSame(listener, socketServer.getLastListener());
+ assertTrue(runner.isRunning());
+ assertSame(listener, receiver.getLastListener());
- socketServer.stop();
- assertFalse(runner.isStarted());
- }
-
- @Test
- public void testStartThrowsException() throws Exception {
- IOException ex = new IOException("test exception");
- runner.setStartException(ex);
- socketServer.start();
- assertFalse(socketServer.isStarted());
- Status status = context.getLastStatus();
- assertNotNull(status);
- assertTrue(status instanceof ErrorStatus);
- assertTrue(status.getMessage().contains(ex.getMessage()));
- assertSame(ex, status.getThrowable());
+ receiver.stop();
+ assertFalse(runner.isRunning());
}
@Test
public void testStartWhenAlreadyStarted() throws Exception {
- socketServer.start();
- socketServer.start();
+ receiver.start();
+ receiver.start();
assertEquals(1, runner.getStartCount());
}
@Test
public void testStopThrowsException() throws Exception {
- socketServer.start();
- assertTrue(socketServer.isStarted());
+ receiver.start();
+ assertTrue(receiver.isStarted());
IOException ex = new IOException("test exception");
runner.setStopException(ex);
- socketServer.stop();
+ receiver.stop();
Status status = context.getLastStatus();
assertNotNull(status);
@@ -115,7 +98,7 @@ public class SocketServerTest {
@Test
public void testStopWhenNotStarted() throws Exception {
- socketServer.stop();
+ receiver.stop();
assertEquals(0, runner.getStartCount());
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/Builder.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/Builder.java
index 022a216d1b7b1a68ba7d8722f38935fdb68573f0..2bc6317d0e939e343013e9b7bc166f4a0a71fd3d 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/Builder.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/Builder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/LoggingEventBuilderInContext.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/LoggingEventBuilderInContext.java
index 2e5879abd08b62e0f04b103ea7108ddafdab180b..61f3fb16277852f37075ee9c1e91d7142cb576b6 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/LoggingEventBuilderInContext.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/LoggingEventBuilderInContext.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2012, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,7 +11,6 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.classic.net.testObjectBuilders;
import ch.qos.logback.classic.Level;
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/LoggingEventWithParametersBuilder.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/LoggingEventWithParametersBuilder.java
index 728d7934d0280a6ab2e634bcf8ca6d55251df2b0..bfe4417d92808fb9c8e4ed78836d67c81c3d85ce 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/LoggingEventWithParametersBuilder.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/LoggingEventWithParametersBuilder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2012, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/MinimalSerBuilder.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/MinimalSerBuilder.java
index 5ab66d13b7b750254bc2b34bd089b51731280ee8..7226c7593b8ba7bdaf8a183986be4114c9ee4928 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/MinimalSerBuilder.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/MinimalSerBuilder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/TrivialLoggingEventBuilder.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/TrivialLoggingEventBuilder.java
index 53edf36e2e60257e9fe468e7b5bdba078535ec68..11f661bc7660cee166c1dfd138b9063eda2ec848 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/TrivialLoggingEventBuilder.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/TrivialLoggingEventBuilder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/TrivialLoggingEventVOBuilder.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/TrivialLoggingEventVOBuilder.java
index d04c2d1d49baf82140aa2829c8e7cb9985f66230..9bdf3c0337efd44a1a9426601440c3891d7464c2 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/TrivialLoggingEventVOBuilder.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/TrivialLoggingEventVOBuilder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
index 7a144f96de3b9893c1bae7daee5e475ec3d01f3c..56a7d05348e0ff42023d81d91a76b33b358b62c1 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java
index 3baa23ae20fc06559f539224b6fbcc2631f1d46e..a383243eaf9eb52113d270b57527c06585a8bf19 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
old mode 100644
new mode 100755
index 5881e4fd5fdf65a902714a942a0aeab7ffd74b7a..df9b10fa845b822dcb8f02d01512825ca87cb312
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -14,7 +14,9 @@
package ch.qos.logback.classic.pattern;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import ch.qos.logback.core.testUtil.RandomUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -31,12 +33,14 @@ public class MDCConverterTest {
LoggerContext lc;
MDCConverter converter;
+ int diff = RandomUtil.getPositiveInt();
@Before
public void setUp() throws Exception {
lc = new LoggerContext();
converter = new MDCConverter();
converter.start();
+ MDC.clear();
}
@After
@@ -44,29 +48,28 @@ public class MDCConverterTest {
lc = null;
converter.stop();
converter = null;
+ MDC.clear();
}
@Test
- public void testConverWithOneEntry() {
- MDC.clear();
- MDC.put("testKey", "testValue");
+ public void testConvertWithOneEntry() {
+ String k = "MDCConverterTest_k"+diff;
+ String v = "MDCConverterTest_v"+diff;
+
+ MDC.put(k, v);
ILoggingEvent le = createLoggingEvent();
String result = converter.convert(le);
- assertEquals("testKey=testValue", result);
+ assertEquals(k+"="+v, result);
}
@Test
- public void testConverWithMultipleEntries() {
- MDC.clear();
+ public void testConvertWithMultipleEntries() {
MDC.put("testKey", "testValue");
MDC.put("testKey2", "testValue2");
ILoggingEvent le = createLoggingEvent();
String result = converter.convert(le);
- if (SystemInfo.getJavaVendor().contains("IBM")) {
- assertEquals("testKey2=testValue2, testKey=testValue", result);
- } else {
- assertEquals("testKey=testValue, testKey2=testValue2", result);
- }
+ boolean isConform = result.matches("testKey2?=testValue2?, testKey2?=testValue2?");
+ assertTrue(result + " is not conform", isConform);
}
private ILoggingEvent createLoggingEvent() {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MarkerConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MarkerConverterTest.java
index 92397df4d71ae6e051a7dbc57f35fefda06bad67..c76404763ca25eeeb290f9ec00dc0afc92b13081 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MarkerConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MarkerConverterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/PackageTest.java
index 64228e9329128e0d902d16e7c2ac3fac6d8a34da..21f445ac7748c63899017696a2211d01eb907b22 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverterTest.java
index ccd0873629482584678ebd04108b797f913af489..cd982bb572237c870022bdda61f6c4f8b52f3b96 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverterTest.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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.classic.pattern;
import ch.qos.logback.classic.Level;
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/TargetLengthBasedClassNameAbbreviatorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/TargetLengthBasedClassNameAbbreviatorTest.java
index 7a64e9b690896bdb657f867d4defeb37d4315259..db5aac83ae1ab0233760be04bf9e45ec15cd14e7 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/TargetLengthBasedClassNameAbbreviatorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/TargetLengthBasedClassNameAbbreviatorTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ThrowableProxyConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ThrowableProxyConverterTest.java
index 4b63b981e59c261afef2cf9f570f44fb4ed1e4cf..34784d3e2a24536a9939a4b7c0719a8d9ac2fa2e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ThrowableProxyConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ThrowableProxyConverterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,10 +13,12 @@
*/
package ch.qos.logback.classic.pattern;
-import static org.junit.Assert.assertEquals;
-
+import java.io.BufferedReader;
import java.io.PrintWriter;
+import java.io.StringReader;
import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
@@ -29,6 +31,8 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.classic.util.TeztHelper;
+import static org.junit.Assert.*;
+
public class ThrowableProxyConverterTest {
LoggerContext lc = new LoggerContext();
@@ -64,6 +68,42 @@ public class ThrowableProxyConverterTest {
verify(t);
}
+ @Test
+ public void withArgumentOfOne() throws Exception {
+ final Throwable t = TeztHelper.makeNestedException(0);
+ t.printStackTrace(pw);
+ final ILoggingEvent le = createLoggingEvent(t);
+
+ final List optionList = Arrays.asList("1");
+ tpc.setOptionList(optionList);
+ tpc.start();
+
+ final String result = tpc.convert(le);
+
+ final BufferedReader reader = new BufferedReader(new StringReader(result));
+ assertTrue(reader.readLine().contains(t.getMessage()));
+ assertNotNull(reader.readLine());
+ assertNull("Unexpected line in stack trace", reader.readLine());
+ }
+
+ @Test
+ public void withShortArgument() throws Exception {
+ final Throwable t = TeztHelper.makeNestedException(0);
+ t.printStackTrace(pw);
+ final ILoggingEvent le = createLoggingEvent(t);
+
+ final List options = Arrays.asList("short");
+ tpc.setOptionList(options);
+ tpc.start();
+
+ final String result = tpc.convert(le);
+
+ final BufferedReader reader = new BufferedReader(new StringReader(result));
+ assertTrue(reader.readLine().contains(t.getMessage()));
+ assertNotNull(reader.readLine());
+ assertNull("Unexpected line in stack trace", reader.readLine());
+ }
+
void verify(Throwable t) {
t.printStackTrace(pw);
@@ -73,6 +113,4 @@ public class ThrowableProxyConverterTest {
result = result.replace("common frames omitted", "more");
assertEquals(sw.toString(), result);
}
-
-
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/PackageTest.java
index 8c1e86f95633f4231b6614cd31128cc5bc1022c4..8fc82a5432e958736bceef6abd5d24ee3aec64b1 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/TimeBasedRollingWithConfigFileTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/TimeBasedRollingWithConfigFileTest.java
index 349e1906e65831ac0b555a794d90eb0492bae6d2..614dc0450a20ecc9c5610dc7aa35b8342b4f2719 100755
--- a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/TimeBasedRollingWithConfigFileTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/TimeBasedRollingWithConfigFileTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java
index d3170e3aca2fcbfaf97b4fe399dab631afc5da52..b2a96e31fb4f3cf833be2bce5cc0291d35fd2dc5 100755
--- a/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/rolling/UniqueFileTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/selector/ContextDetachingSCLTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/selector/ContextDetachingSCLTest.java
index a96c20937f49fe195e84e8f02b68f6ba9b3b345e..9c2b39fc0d1d841fba5463c439e1c1d328e9567a 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/selector/ContextDetachingSCLTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/selector/ContextDetachingSCLTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/selector/ContextJNDISelectorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/selector/ContextJNDISelectorTest.java
index fc298bcc31988c26d62f847b7627487fe61896cc..d2538af23417cb87fe613a171ceacc94e0f4d063 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/selector/ContextJNDISelectorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/selector/ContextJNDISelectorTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/selector/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/selector/PackageTest.java
index 88d8eb83b5777f4250f498b244c9fc2c1783a5fb..72b7b047653de8f8bc3d7721ec281b79bd21685f 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/selector/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/selector/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/sift/MDCBasedDiscriminatorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/sift/MDCBasedDiscriminatorTest.java
old mode 100644
new mode 100755
index 08ef733adbb2e790f35c6ae4e8efd575b25ec2e0..d1b08d87484bb3164367d18fd65f12e572a58b5b
--- a/logback-classic/src/test/java/ch/qos/logback/classic/sift/MDCBasedDiscriminatorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/sift/MDCBasedDiscriminatorTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -42,8 +42,8 @@ public class MDCBasedDiscriminatorTest {
Logger logger = context.getLogger(this.getClass());
int diff = RandomUtil.getPositiveInt();
- String key = "k" + diff;
- String value = "val" + diff;
+ String key = "MDCBasedDiscriminatorTest_key" + diff;
+ String value = "MDCBasedDiscriminatorTest_val" + diff;
LoggingEvent event;
@Before
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/sift/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/sift/PackageTest.java
index 5d90607995643f27d4b0ddf352d0eaad45aa6b59..d66fe4ca9bace69282d931e3e3737769eaed91ce 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/sift/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/sift/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java
index 50f5454ce95bb8c84ec84ca59c7375de402cfa4e..d998dc22e1f79a929fce84d2de4095fc142dc5d8 100755
--- a/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/sift/SiftingAppenderTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,31 +13,29 @@
*/
package ch.qos.logback.classic.sift;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.junit.Test;
-import org.slf4j.MDC;
-
-import ch.qos.logback.classic.ClassicTestConstants;
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.*;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.Appender;
import ch.qos.logback.core.helpers.NOPAppender;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.read.ListAppender;
import ch.qos.logback.core.sift.AppenderTracker;
+import ch.qos.logback.core.spi.AbstractComponentTracker;
+import ch.qos.logback.core.spi.ComponentTracker;
import ch.qos.logback.core.status.ErrorStatus;
import ch.qos.logback.core.status.StatusChecker;
+import ch.qos.logback.core.testUtil.RandomUtil;
import ch.qos.logback.core.testUtil.StringListAppender;
import ch.qos.logback.core.util.StatusPrinter;
+import org.junit.Test;
+import org.slf4j.MDC;
+
+import java.util.List;
+
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
public class SiftingAppenderTest {
@@ -46,8 +44,10 @@ public class SiftingAppenderTest {
LoggerContext loggerContext = new LoggerContext();
Logger logger = loggerContext.getLogger(this.getClass().getName());
Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
- StatusChecker sc = new StatusChecker(loggerContext);
-
+ StatusChecker statusChecker = new StatusChecker(loggerContext);
+ int diff = RandomUtil.getPositiveInt();
+ int now = 0;
+
protected void configure(String file) throws JoranException {
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(loggerContext);
@@ -66,16 +66,19 @@ public class SiftingAppenderTest {
public void smoke() throws JoranException {
configure(SIFT_FOLDER_PREFIX + "smoke.xml");
logger.debug("smoke");
- long timestamp = 0;
- SiftingAppender ha = (SiftingAppender) root.getAppender("SIFT");
- ListAppender listAppender = (ListAppender) ha
- .getAppenderTracker().get("smoke", timestamp);
- assertNotNull(listAppender);
+ Appender appender = getAppenderTracker().find("smokeDefault");
+ assertNotNull(appender);
+ ListAppender listAppender = (ListAppender) appender;
List eventList = listAppender.list;
assertEquals(1, listAppender.list.size());
assertEquals("smoke", eventList.get(0).getMessage());
}
+ private AppenderTracker getAppenderTracker() {
+ SiftingAppender ha = (SiftingAppender) root.getAppender("SIFT");
+ return ha.getAppenderTracker();
+ }
+
@Test
public void zeroNesting() throws JoranException {
configure(SIFT_FOLDER_PREFIX + "zeroNesting.xml");
@@ -84,18 +87,14 @@ public class SiftingAppenderTest {
logger.debug("hello");
logger.debug("hello");
logger.debug("hello");
-
- long timestamp = 0;
-
SiftingAppender sa = (SiftingAppender) root.getAppender("SIFT");
- NOPAppender nopa = (NOPAppender) sa
- .getAppenderTracker().get("smoke", timestamp);
+
+ Appender appender = getAppenderTracker().find("zeroDefault");
+ assertNotNull(appender);
+ NOPAppender nopa = (NOPAppender) appender;
StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
- assertNotNull(nopa);
- sc.assertContainsMatch(ErrorStatus.ERROR, "No nested appenders found");
- sc.assertContainsMatch(ErrorStatus.ERROR,
- "Failed to build an appender for discriminating value \\[smoke\\]");
+ statusChecker.assertContainsMatch(ErrorStatus.ERROR, "No nested appenders found");
}
@Test
@@ -105,26 +104,21 @@ public class SiftingAppenderTest {
logger.debug("hello");
logger.debug("hello");
- long timestamp = 0;
-
- SiftingAppender sa = (SiftingAppender) root.getAppender("SIFT");
- ListAppender listAppender = (ListAppender) sa
- .getAppenderTracker().get("smoke", timestamp);
+ Appender listAppender = getAppenderTracker().find("multipleDefault");
StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
assertNotNull(listAppender);
- sc.assertContainsMatch(ErrorStatus.ERROR,
- "Only and only one appender can be nested");
+ statusChecker.assertContainsMatch(ErrorStatus.ERROR,
+ "Only and only one appender can be nested");
}
@Test
public void defaultLayoutRule() throws JoranException {
configure(SIFT_FOLDER_PREFIX + "defaultLayoutRule.xml");
logger.debug("hello");
- long timestamp = 0;
SiftingAppender ha = (SiftingAppender) root.getAppender("SIFT");
StringListAppender listAppender = (StringListAppender) ha
- .getAppenderTracker().get("default", timestamp);
+ .getAppenderTracker().find("default");
assertNotNull(listAppender);
List strList = listAppender.strList;
@@ -139,9 +133,9 @@ public class SiftingAppenderTest {
MDC.put(mdcKey, "a");
logger.debug("smoke");
long timestamp = System.currentTimeMillis();
- SiftingAppender ha = (SiftingAppender) root.getAppender("SIFT");
- ListAppender listAppender = (ListAppender) ha
- .getAppenderTracker().get("a", timestamp);
+ SiftingAppender sa = (SiftingAppender) root.getAppender("SIFT");
+ ListAppender listAppender = (ListAppender)
+ sa.getAppenderTracker().find("a");
assertNotNull(listAppender);
List eventList = listAppender.list;
assertEquals(1, listAppender.list.size());
@@ -149,12 +143,130 @@ public class SiftingAppenderTest {
MDC.remove(mdcKey);
LoggingEvent le = new LoggingEvent("x", logger, Level.INFO, "hello", null,
- null);
- le.setTimeStamp(timestamp + AppenderTracker.THRESHOLD * 2);
- ha.doAppend(le);
+ null);
+ le.setTimeStamp(timestamp + ComponentTracker.DEFAULT_TIMEOUT + 1);
+ sa.doAppend(le);
assertFalse(listAppender.isStarted());
- assertEquals(1, ha.getAppenderTracker().keyList().size());
- assertEquals("cycleDefault", ha.getAppenderTracker().keyList().get(0));
+ assertEquals(1, sa.getAppenderTracker().allKeys().size());
+ assertTrue(sa.getAppenderTracker().allKeys().contains("cycleDefault"));
+ }
+
+ @Test
+ public void sessionFinalizationShouldCauseLingering() throws JoranException {
+ String mdcKey = "linger";
+ String mdcVal = "session" + diff;
+ configure(SIFT_FOLDER_PREFIX + "lingering.xml");
+ MDC.put(mdcKey, mdcVal);
+ logger.debug("linger 1");
+ logger.debug(ClassicConstants.FINALIZE_SESSION_MARKER, "linger 2");
+ long now = System.currentTimeMillis();
+ SiftingAppender sa = (SiftingAppender) root.getAppender("SIFT");
+ AppenderTracker tracker = sa.getAppenderTracker();
+
+ assertEquals(1, tracker.allKeys().size());
+ Appender appender = tracker.find(mdcVal);
+ assertTrue(appender.isStarted());
+
+ tracker.removeStaleComponents(now + AppenderTracker.LINGERING_TIMEOUT + 1);
+ // previously lingering appenders should be closed upon timeout
+ assertFalse(appender.isStarted());
+ // and they should be gone
+ assertEquals(0, tracker.allKeys().size());
+ }
+
+ @Test
+ public void localPropertiesShouldBeVisible() throws JoranException {
+ String mdcKey = "localProperty";
+ String mdcVal = "" + diff;
+ String msg = "localPropertiesShouldBeVisible";
+ String prefix = "Y";
+ configure(SIFT_FOLDER_PREFIX + "propertyPropagation.xml");
+ MDC.put(mdcKey, mdcVal);
+ logger.debug(msg);
+ SiftingAppender sa = (SiftingAppender) root.getAppender("SIFT");
+ StringListAppender listAppender = (StringListAppender) sa
+ .getAppenderTracker().find(mdcVal);
+ assertNotNull(listAppender);
+ List strList = listAppender.strList;
+ assertEquals(1, listAppender.strList.size());
+ assertEquals(prefix + msg, strList.get(0));
+ }
+
+ @Test
+ public void propertyDefinedWithinSiftElementShouldBeVisible() throws JoranException {
+ String mdcKey = "propertyDefinedWithinSift";
+ String mdcVal = "" + diff;
+ String msg = "propertyDefinedWithinSiftElementShouldBeVisible";
+ String prefix = "Y";
+ configure(SIFT_FOLDER_PREFIX + "propertyDefinedInSiftElement.xml");
+ MDC.put(mdcKey, mdcVal);
+ logger.debug(msg);
+ SiftingAppender sa = (SiftingAppender) root.getAppender("SIFT");
+ StringListAppender listAppender = (StringListAppender) sa
+ .getAppenderTracker().find(mdcVal);
+ assertNotNull(listAppender);
+ List strList = listAppender.strList;
+ assertEquals(1, listAppender.strList.size());
+ assertEquals(prefix + msg, strList.get(0));
+ }
+
+ @Test
+ public void compositePropertyShouldCombineWithinAndWithoutSiftElement() throws JoranException {
+ String mdcKey = "compositeProperty";
+ String mdcVal = "" + diff;
+ String msg = "compositePropertyShouldCombineWithinAndWithoutSiftElement";
+ String prefix = "composite";
+ configure(SIFT_FOLDER_PREFIX + "compositeProperty.xml");
+ MDC.put(mdcKey, mdcVal);
+ logger.debug(msg);
+ SiftingAppender sa = (SiftingAppender) root.getAppender("SIFT");
+ StringListAppender listAppender = (StringListAppender) sa
+ .getAppenderTracker().find(mdcVal);
+ assertNotNull(listAppender);
+ List strList = listAppender.strList;
+ assertEquals(1, listAppender.strList.size());
+ assertEquals(prefix + msg, strList.get(0));
+ }
+
+ @Test
+ public void maxAppendersCountPropertyShouldBeHonored() throws JoranException {
+ configure(SIFT_FOLDER_PREFIX + "maxAppenderCount.xml");
+ int max = 5;
+ SiftingAppender sa = (SiftingAppender) root.getAppender("SIFT");
+ String mdcKey = "max";
+ for(int i = 0; i <= max; i++) {
+ MDC.put(mdcKey, "" + (diff + i));
+ LoggingEvent event = new LoggingEvent("", logger, Level.DEBUG, "max"+i, null, null);
+ event.setTimeStamp(now);
+ sa.doAppend(event);
+ now += AbstractComponentTracker.WAIT_BETWEEN_SUCCESSIVE_REMOVAL_ITERATIONS;
+ }
+ AppenderTracker tracker = sa.getAppenderTracker();
+ assertEquals(max, tracker.allKeys().size());
+ assertNull(tracker.find("" + (diff + 0)));
+ for(int i = 1; i <= max; i++) {
+ assertNotNull(tracker.find("" + (diff + i)));
+ }
+ }
+
+ @Test
+ public void timeoutPropertyShouldBeHonored() throws JoranException, InterruptedException {
+ configure(SIFT_FOLDER_PREFIX + "timeout.xml");
+ long timeout = 30*1000;
+ SiftingAppender sa = (SiftingAppender) root.getAppender("SIFT");
+
+ LoggingEvent event = new LoggingEvent("", logger, Level.DEBUG, "timeout", null, null);
+ event.setTimeStamp(now);
+ sa.doAppend(event);
+
+ AppenderTracker tracker = sa.getAppenderTracker();
+
+ assertEquals(1, tracker.getComponentCount());
+
+ now += timeout+1;
+ tracker.removeStaleComponents(now);
+ assertEquals(0, tracker.getComponentCount());
+ statusChecker.assertIsErrorFree();
}
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/BasicContextListener.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/BasicContextListener.java
index 3c50f7d14dd6186ccdcbbe93a1ae1799aaeeaf17..5a30b8f1641ea8a3c580eaa4acc505ef3c168352 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/BasicContextListener.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/BasicContextListener.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/BogusClassLoader.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/BogusClassLoader.java
index 208fd11cdedbc7bdbf9f150291751ec01a5b205d..eabfc087c05f96b59c6b5e0dffee0253d2661242 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/BogusClassLoader.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/BogusClassLoader.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/CPDCSpecial.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/CPDCSpecial.java
index 66e7edcfac9f50b3a44d0acdb7c679c51c79f115..8842ddd1d02d6f09ae333a3aa45f02efb7d7b29f 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/CPDCSpecial.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/CPDCSpecial.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/CallerDataTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/CallerDataTest.java
index 47850d8767747f39a1937887f19593841eb02c7d..e99f34142fff363c3a08d65558bee2b7baf09207 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/CallerDataTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/CallerDataTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/ContextListenerTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/ContextListenerTest.java
index b8a8751a695ee8d6f0ddeed33a466a0258ae95c7..3912a58e295962953002ade7409d29ebd959c436 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/ContextListenerTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/ContextListenerTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java
index b6e48bd176fd6eba87d1863e72001bcd5aef2a8d..0d9c554cdf2823e3f01b6c7cd6cd6d2fba7bbf74 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LocalFirstClassLoader.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LocalFirstClassLoader.java
index 4fcaf8d2d93c964d9a44b846e7f8582f2a587e8f..7c2be9a9786a7d8482483d5e255fdf46aa0a40b2 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LocalFirstClassLoader.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LocalFirstClassLoader.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggerComparatorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggerComparatorTest.java
index ea5d35595130c0a080b1ebc7f5e8cd413b5e7103..a752d472e9e9d61c238bd443b5230e6fad19d918 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggerComparatorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggerComparatorTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationPerfTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationPerfTest.java
index ecc6a1d357ec78d1abd82cca2eea51686b9cff09..02a3cf13ce1bf071c89e27c94f535d1a69d8bcff 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationPerfTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationPerfTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
index 2d73426db2a59181534cbde134a7a21a62ea795b..24e88606770487caed65ed0f8e07283fe701ddfe 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventTest.java
new file mode 100755
index 0000000000000000000000000000000000000000..c68902212639b36b57912380ffaa5f331ca05208
--- /dev/null
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventTest.java
@@ -0,0 +1,65 @@
+package ch.qos.logback.classic.spi;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import org.junit.Before;
+import org.junit.Test;
+
+import static junit.framework.Assert.assertNull;
+import static org.junit.Assert.assertEquals;
+
+public class LoggingEventTest {
+
+ LoggerContext loggerContext = new LoggerContext();
+ Logger logger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
+
+ @Before
+ public void setUp() {
+ }
+
+
+ @Test
+ public void testFormattingOneArg() {
+ String message = "x={}";
+ Throwable throwable = null;
+ Object[] argArray = new Object[] {12};
+
+ LoggingEvent event = new LoggingEvent("", logger, Level.INFO, message, throwable, argArray);
+ assertNull(event.formattedMessage);
+ assertEquals("x=12", event.getFormattedMessage());
+ }
+
+
+ @Test
+ public void testFormattingTwoArg() {
+ String message = "{}-{}";
+ Throwable throwable = null;
+ Object[] argArray = new Object[] {12, 13};
+ LoggingEvent event = new LoggingEvent("", logger, Level.INFO, message, throwable, argArray);
+
+ assertNull(event.formattedMessage);
+ assertEquals("12-13", event.getFormattedMessage());
+ }
+
+
+ @Test
+ public void testNoFormattingWithArgs() {
+ String message = "testNoFormatting";
+ Throwable throwable = null;
+ Object[] argArray = new Object[] {12, 13};
+ LoggingEvent event = new LoggingEvent("", logger, Level.INFO, message, throwable, argArray);
+ assertNull(event.formattedMessage);
+ assertEquals(message, event.getFormattedMessage());
+ }
+
+ @Test
+ public void testNoFormattingWithoutArgs() {
+ String message = "testNoFormatting";
+ Throwable throwable = null;
+ Object[] argArray = null;
+ LoggingEvent event = new LoggingEvent("", logger, Level.INFO, message, throwable, argArray);
+ assertNull(event.formattedMessage);
+ assertEquals(message, event.getFormattedMessage());
+ }
+}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LuckyCharms.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LuckyCharms.java
index 0048286e29757c14e4e08b0d8f9029a01c78f374..941a40588207c21c4359edd0182fe60dcb375fcb 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LuckyCharms.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LuckyCharms.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackageTest.java
index 15a55ebdf6e25dc886babb494e0a6c15bc8c81d5..b9214201dc2d07d1c98c7490df05e45f98ffa8bd 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -19,7 +19,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses( { ContextListenerTest.class, CallerDataTest.class,
- LoggerComparatorTest.class, LoggingEventSerializationTest.class,
+ LoggerComparatorTest.class, LoggingEventTest.class, LoggingEventSerializationTest.class,
LoggingEventSerializationPerfTest.class, ThrowableProxyTest.class,
PackagingDataCalculatorTest.class })
public class PackageTest {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackagingDataCalculatorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackagingDataCalculatorTest.java
index 385dcfde3ea023f15f832fb70b2fae952291daff..c499d3309e8a4f5107d7db42063384e87e02fabb 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackagingDataCalculatorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackagingDataCalculatorTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/PubLoggingEventVO.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/PubLoggingEventVO.java
index 3018f62166c2804f30b4b35da3babd801344f7c8..d8d90cbda308d7cdbe648a6687ab01e97a59dfb9 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/PubLoggingEventVO.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/PubLoggingEventVO.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java
index d5ff8248cdbb9e5540be25579c97adf76e8303c3..2d0aba0ee87eb804fd9b4fda747b61454cdb5e17 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/special/CPDCSpecialImpl.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/special/CPDCSpecialImpl.java
index a8d6bc593de8293170403363a43e6e467c7f81b5..41e3c64a70c159fa012290c4eff79504779f339a 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/special/CPDCSpecialImpl.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/special/CPDCSpecialImpl.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/testUtil/SampleConverter.java b/logback-classic/src/test/java/ch/qos/logback/classic/testUtil/SampleConverter.java
index 2ea49586f05dab7449185fd478caf675214bd67c..7d93da14c7e191b8c15224d34a7b67e84fd699c0 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/testUtil/SampleConverter.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/testUtil/SampleConverter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DebugUsersTurboFilter.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DebugUsersTurboFilter.java
index e74980e598fba506cd82f36580f5dfee945f82e9..b6285038a96530a329e8c28a67e5c5fd4abccc35 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DebugUsersTurboFilter.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DebugUsersTurboFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java
index 04eacbc93d6df452499fb096dd4231cfad159f62..7f9a8447233e0b37f34627df6278caa729048e4e 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/DuplicateMessageFilterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/LRUMessageCacheTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/LRUMessageCacheTest.java
index 3ec9f39770a9d0ef7f500fcd06cde3ff6c25c548..f49bb74377cc75487cb606b8cd5ec8390b82674d 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/LRUMessageCacheTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/LRUMessageCacheTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java
index 7d23a8b01b2721ead9d779db2cddcbee33e3f725..20767af66cacdcdcd870bbf190c0fa1677c004cc 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/MarkerFilterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/NOPTurboFilter.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/NOPTurboFilter.java
index f55f16eab17894ade7203873ef0396cb320c0963..6c8694feebdc09b6536378fae11f7f1a7923a14b 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/NOPTurboFilter.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/NOPTurboFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/PackageTest.java
index 2e94ec5915bd2d9e6b28d8b81aaecdc110ca951e..b57aa90bf1d984d32f4df854ed8e40df3d72440a 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
index c6ce8753af356536b172b2d4e73f12a4c9507ef7..591ddcb472267b1fa4b831f267de59e475feb49a 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/Event.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/Event.java
index a6e41a650fc5222e4d71aa26859e15473e70e00d..f45978524380b876cc3bb99fab90cc51fd664cbd 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/Event.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/Event.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/LRUCache.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/LRUCache.java
index 12b55705ab9af4a7462156697b3db5bfdfde2517..5dc53d1d9f891cfe007ef8b8f49512f254b8d5cc 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/LRUCache.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/LRUCache.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/LRUCacheTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/LRUCacheTest.java
index 13c01203168cbb18902106421f2db1affb8b3f0a..f367301fd48e77e9e9622701db7b5af35da58440 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/LRUCacheTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/LRUCacheTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/Simulator.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/Simulator.java
index f30588457d3ab16c005411b4dad71f490bf7b073..72bb87942128940846420ff17afdd813fcb9528b 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/Simulator.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/Simulator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/T_Entry.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/T_Entry.java
index 4189712c2371b31b6983b0031b3acc560de5661d..dd9bcf3ff8a6e14ec35a8c5ae444f47ec396bda4 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/T_Entry.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/T_Entry.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/T_LRUCache.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/T_LRUCache.java
index bc9101d96d02a35889d031c42a2d411556323592..23fdfd69be1993b8305c484359d1f176ad9c1305 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/T_LRUCache.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/T_LRUCache.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/X_LRUCache.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/X_LRUCache.java
index 167cca3b632980c736181665a740caa2040ea419..146ab94eb9560227ba2f113c0efc7598796083fa 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/X_LRUCache.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/lru/X_LRUCache.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerAutoConfigTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerAutoConfigTest.java
index 8251c8a1fcffd4d3af50e9a873f8fb01b4672fcd..9a83de32cec8c4be21d24c25db7aa07c1533dfe2 100755
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerAutoConfigTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerAutoConfigTest.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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.classic.util;
import ch.qos.logback.classic.Logger;
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java
index 98006db5607a18a92e2eb706615964c22f5f200c..ffc5c93accc1b72db997b5ae8865535be82d39cc 100755
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationIntegrationTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationIntegrationTest.java
index 07419271f1078734c62d7f0cc3000c1c7c9ea10f..6354e0fe9fb9c1fe893f12af572043eadf39fe90 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationIntegrationTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationIntegrationTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/LevelToSyslogSeverityTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/LevelToSyslogSeverityTest.java
index 51cfef79aeefb933131503ea36466c3ce045cd3c..9ec55bdd8de66e6ea0a5fa9faf9a803198fba668 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/LevelToSyslogSeverityTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/LevelToSyslogSeverityTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/LogbackMDCAdapterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/LogbackMDCAdapterTest.java
index 6918e70d935a7ce9e24db21010c50edfe70df9d3..d05d997a39520211a19dd58ed50f308996d3df5a 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/LogbackMDCAdapterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/LogbackMDCAdapterTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/LoggerNameUtilTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/LoggerNameUtilTest.java
index 0efd5e2ff6f590587c355a86b910be9e27485618..1f3614c18f59e3a165c082462ecddb847cebde6f 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/LoggerNameUtilTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/LoggerNameUtilTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2012, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -74,5 +74,29 @@ public class LoggerNameUtilTest {
assertEquals(witnessList, partList);
}
+ @Test
+ public void supportNestedClassesWithNestedDot() {
+ //LOGBACK-384
+ List witnessList = new ArrayList();
+ witnessList.add("com");
+ witnessList.add("foo");
+ witnessList.add("Bar");
+ witnessList.add("Nested");
+ witnessList.add("dot");
+
+ List partList = LoggerNameUtil.computeNameParts("com.foo.Bar$Nested.dot");
+ assertEquals(witnessList, partList);
+ }
+
+ @Test
+ public void supportNestedClassesAtBeginning() {
+ List witnessList = new ArrayList();
+ witnessList.add("foo");
+ witnessList.add("Nested");
+ witnessList.add("bar");
+
+ List partList = LoggerNameUtil.computeNameParts("foo$Nested.bar");
+ assertEquals(witnessList, partList);
+ }
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/MockInitialContext.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/MockInitialContext.java
index 4cfab67f57bc4f81f35af4e9da5888c704d80764..ea3c5a97f119d268f7d2538b7621c9d07e5501f2 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/MockInitialContext.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/MockInitialContext.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/MockInitialContextFactory.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/MockInitialContextFactory.java
index 3ba06f972508e295562115b116e2bf2f75a2b606..06f59d550238e8b7445a376230d7992a22960c16 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/MockInitialContextFactory.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/MockInitialContextFactory.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/PackageTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/PackageTest.java
index 87129bb8c8cbc4f2a4ae35099ffa8506295b3b3c..70ad014cb550495a4d376c5a6b49ff23e6d8e405 100755
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/PackageTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/util/TeztHelper.java b/logback-classic/src/test/java/ch/qos/logback/classic/util/TeztHelper.java
index badde04c350c4d8692fe0455a9e046343cb0769d..2bee5886e7fc25ea29073b34b6c2d1db9d83d23d 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/util/TeztHelper.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/util/TeztHelper.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/integrator/Activator.java b/logback-classic/src/test/java/integrator/Activator.java
index 3dfe195a0d30d9ce66f3704cc4f90708de3e5a83..0a7493b9c8539726d4feb92720c4c98eb616f8aa 100644
--- a/logback-classic/src/test/java/integrator/Activator.java
+++ b/logback-classic/src/test/java/integrator/Activator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/dummy/DummyLBAppender.java b/logback-classic/src/test/java/org/dummy/DummyLBAppender.java
index 19957ebd1b01a808f8872618ae067436c5aa555c..5c7fc00f6026b78f61ba6ed8635f690eddafef1b 100644
--- a/logback-classic/src/test/java/org/dummy/DummyLBAppender.java
+++ b/logback-classic/src/test/java/org/dummy/DummyLBAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/dummy/Log4jInvocation.java b/logback-classic/src/test/java/org/dummy/Log4jInvocation.java
index 81c38d1220e4863018854dc483f565f883c8bcbc..f512ce76421e0161328b2c3e63235202016ad24d 100644
--- a/logback-classic/src/test/java/org/dummy/Log4jInvocation.java
+++ b/logback-classic/src/test/java/org/dummy/Log4jInvocation.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/slf4j/LoggerFactoryFriend.java b/logback-classic/src/test/java/org/slf4j/LoggerFactoryFriend.java
index 905f4dacc426291992e3f8a525318d265015be30..ec520e2969b9cb03b7e3f7b56322ccb3e4907288 100644
--- a/logback-classic/src/test/java/org/slf4j/LoggerFactoryFriend.java
+++ b/logback-classic/src/test/java/org/slf4j/LoggerFactoryFriend.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/slf4j/impl/InitializationOutputTest.java b/logback-classic/src/test/java/org/slf4j/impl/InitializationOutputTest.java
index 99039fdece60a7e779829870767d4edc5fc19880..b747d8d1a211d8c76334ab9e3a8734da9aea70ed 100644
--- a/logback-classic/src/test/java/org/slf4j/impl/InitializationOutputTest.java
+++ b/logback-classic/src/test/java/org/slf4j/impl/InitializationOutputTest.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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 org.slf4j.impl;
import ch.qos.logback.classic.ClassicTestConstants;
diff --git a/logback-classic/src/test/java/org/slf4j/impl/PackageTest.java b/logback-classic/src/test/java/org/slf4j/impl/PackageTest.java
index 3f563bdbb12dc5b5bd29c9b55358bec40658955a..488091c2263b7f3b4e7b006efc6b2f1416a315cb 100644
--- a/logback-classic/src/test/java/org/slf4j/impl/PackageTest.java
+++ b/logback-classic/src/test/java/org/slf4j/impl/PackageTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/slf4j/impl/RecursiveInitializationTest.java b/logback-classic/src/test/java/org/slf4j/impl/RecursiveInitializationTest.java
index 4c4006e4e27ef00041e85e9df15984758f4f5fdc..18c5171c21d6bd65a0489cc173537c6238afa8e7 100644
--- a/logback-classic/src/test/java/org/slf4j/impl/RecursiveInitializationTest.java
+++ b/logback-classic/src/test/java/org/slf4j/impl/RecursiveInitializationTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/slf4j/impl/RecursiveLBAppender.java b/logback-classic/src/test/java/org/slf4j/impl/RecursiveLBAppender.java
index 56195517a2f1fde5039c785f4e7aa409d6e345fd..89d3e994c63b97fd3be306d787e9f68c46f16052 100644
--- a/logback-classic/src/test/java/org/slf4j/impl/RecursiveLBAppender.java
+++ b/logback-classic/src/test/java/org/slf4j/impl/RecursiveLBAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/slf4j/impl/StaticLoggerBinderFriend.java b/logback-classic/src/test/java/org/slf4j/impl/StaticLoggerBinderFriend.java
index d6a65cacab15c83e2351ab62a808cb4720683940..7b879185439169456182fe1c799aec6bf4983f6f 100644
--- a/logback-classic/src/test/java/org/slf4j/impl/StaticLoggerBinderFriend.java
+++ b/logback-classic/src/test/java/org/slf4j/impl/StaticLoggerBinderFriend.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/slf4j/test_osgi/BundleTest.java b/logback-classic/src/test/java/org/slf4j/test_osgi/BundleTest.java
index 8b20e3adef4d3e968c6973bbd4495cc49a389bac..20c94f532910da19b8f372b3fae5bcde1a2eda0c 100644
--- a/logback-classic/src/test/java/org/slf4j/test_osgi/BundleTest.java
+++ b/logback-classic/src/test/java/org/slf4j/test_osgi/BundleTest.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/slf4j/test_osgi/CheckingBundleListener.java b/logback-classic/src/test/java/org/slf4j/test_osgi/CheckingBundleListener.java
index c2f358e156f62377d3465b310072f939b99b46b0..2f0b7a302d783e7867643c92c2429061bd80c797 100644
--- a/logback-classic/src/test/java/org/slf4j/test_osgi/CheckingBundleListener.java
+++ b/logback-classic/src/test/java/org/slf4j/test_osgi/CheckingBundleListener.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/slf4j/test_osgi/FelixHost.java b/logback-classic/src/test/java/org/slf4j/test_osgi/FelixHost.java
index 8811f2924418bbdc697eff4b1fa5875c9aa3099f..65026643649e1c277bc4b999f1c2cb09f534c83a 100644
--- a/logback-classic/src/test/java/org/slf4j/test_osgi/FelixHost.java
+++ b/logback-classic/src/test/java/org/slf4j/test_osgi/FelixHost.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-classic/src/test/java/org/slf4j/test_osgi/FrameworkErrorListener.java b/logback-classic/src/test/java/org/slf4j/test_osgi/FrameworkErrorListener.java
index c39266db153c28340c663c6e06ebd8b75b8f4644..02fa91d275eff9e34b499d01dabd8274203875af 100644
--- a/logback-classic/src/test/java/org/slf4j/test_osgi/FrameworkErrorListener.java
+++ b/logback-classic/src/test/java/org/slf4j/test_osgi/FrameworkErrorListener.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/pom.xml b/logback-core/pom.xml
index 24b3ca757236de72332d688be39583394e5690b6..7cdc66e91b67fc8c54dedea60326753e7ca9f59c 100755
--- a/logback-core/pom.xml
+++ b/logback-core/pom.xml
@@ -7,7 +7,7 @@
ch.qos.logbacklogback-parent
- 1.0.12-SNAPSHOT
+ 2.0.0-SNAPSHOTlogback-core
@@ -87,29 +87,21 @@
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- 1.5
-
-
-
org.apache.maven.pluginsmaven-surefire-plugin
- ${surefire.version}
+ ${maven-surefire-plugin.version}onceplain
- classes
+
false**/All*Test.java**/PackageTest.java
+
**/ConsoleAppenderTest.java
- **/TimeBasedRollingTest.java
+
@@ -117,6 +109,7 @@
org.apache.maven.pluginsmaven-jar-plugin
+ ${maven-jar-plugin.version}${project.build.outputDirectory}/META-INF/MANIFEST.MF
diff --git a/logback-core/src/main/java/ch/qos/logback/core/Appender.java b/logback-core/src/main/java/ch/qos/logback/core/Appender.java
index ff76f42007beb964939c78a7e57f573afe976fc3..8684df8340eed4dc0d557f1e4fb91bffa9225ab8 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/Appender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/Appender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/AppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/AppenderBase.java
index 08a325c6a3cf43f05693ef84076cbfc9165af59f..9795c61eeda6d2f073b73ee192c71f3470104daf 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/AppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/AppenderBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java
index 6345df1a094bcffd952f4e4d3d1210200a2bbcad..8718737f2a68d4b64eb0a9791d1746cc34018d97 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2012, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -106,7 +106,7 @@ public class AsyncAppenderBase extends UnsynchronizedAppenderBase implemen
if (!isStarted())
return;
- // mark this appender as stopped so that Worker can also stop if it is invoking aii.appendLoopOnAppenders
+ // mark this appender as stopped so that Worker can also processPriorToRemoval if it is invoking aii.appendLoopOnAppenders
// and sub-appenders consume the interruption
super.stop();
diff --git a/logback-core/src/main/java/ch/qos/logback/core/BasicStatusManager.java b/logback-core/src/main/java/ch/qos/logback/core/BasicStatusManager.java
index ff5567d0c43cea1a4c93b36172ffa0a27da3ae9c..6f1fc05d55b44b48bb0474de19af4e6466563e39 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/BasicStatusManager.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/BasicStatusManager.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/ConsoleAppender.java b/logback-core/src/main/java/ch/qos/logback/core/ConsoleAppender.java
index 3b2be6b54940df79582639a9fbb09c493472bafe..cd238c61aed0e50451d9df6ac47c3f7a86303207 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/ConsoleAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/ConsoleAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/Context.java b/logback-core/src/main/java/ch/qos/logback/core/Context.java
index aaceaa0fe0b3b72979617e85af137a09ccb20a98..f164647291f7391d1caf5a2d4336b888f644f6e0 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/Context.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/Context.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -16,6 +16,7 @@ package ch.qos.logback.core;
import java.util.Map;
import java.util.concurrent.ExecutorService;
+import ch.qos.logback.core.spi.LifeCycle;
import ch.qos.logback.core.spi.PropertyContainer;
import ch.qos.logback.core.status.StatusManager;
@@ -113,4 +114,15 @@ public interface Context extends PropertyContainer {
* @since 1.0.0
*/
ExecutorService getExecutorService();
+
+ /**
+ * Register a component that participates in the context's life cycle.
+ *
+ * All components registered via this method will be stopped and removed
+ * from the context when the context is reset.
+ *
+ * @param component the subject component
+ */
+ void register(LifeCycle component);
+
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java b/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
old mode 100644
new mode 100755
index 39255a6de28ce67f7beb1ef7cd2f45ac34379b32..7ef658106bdbf1590a0db14bcd23e6e0c28a07cf
--- a/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,17 +13,18 @@
*/
package ch.qos.logback.core;
+import static ch.qos.logback.core.CoreConstants.CONTEXT_NAME_KEY;
+
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.*;
+import java.util.concurrent.ExecutorService;
+import ch.qos.logback.core.spi.LifeCycle;
import ch.qos.logback.core.spi.LogbackLock;
import ch.qos.logback.core.status.StatusManager;
-import ch.qos.logback.core.util.EnvUtil;
-
-import static ch.qos.logback.core.CoreConstants.CONTEXT_NAME_KEY;
+import ch.qos.logback.core.util.ExecutorServiceUtil;
-public class ContextBase implements Context {
+public class ContextBase implements Context, LifeCycle {
private long birthTime = System.currentTimeMillis();
@@ -37,15 +38,10 @@ public class ContextBase implements Context {
LogbackLock configurationLock = new LogbackLock();
- // CORE_POOL_SIZE must be 1 for JDK 1.5. For JD 1.6 or higher it's set to 0
- // so that there are no idle threads
- private static final int CORE_POOL_SIZE = EnvUtil.isJDK5() ? 1 : 0;
-
- // 0 (JDK 1,6+) or 1 (JDK 1.5) idle threads, 2 maximum threads, no idle waiting
- ExecutorService executorService = new ThreadPoolExecutor(CORE_POOL_SIZE, 2,
- 0L, TimeUnit.MILLISECONDS,
- new LinkedBlockingQueue());
-
+ private volatile ExecutorService executorService;
+ private LifeCycleManager lifeCycleManager;
+ private boolean started;
+
public StatusManager getStatusManager() {
return sm;
}
@@ -102,10 +98,29 @@ public class ContextBase implements Context {
return name;
}
+ public void start() {
+ // We'd like to create the executor service here, but we can't;
+ // ContextBase has not always implemented LifeCycle and there are *many*
+ // uses (mostly in tests) that would need to be modified.
+ started = true;
+ }
+
+ public void stop() {
+ // We don't check "started" here, because the executor service uses
+ // lazy initialization, rather than being created in the start method
+ stopExecutorService();
+ started = false;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
/**
* Clear the internal objectMap and all properties.
*/
public void reset() {
+ getLifeCycleManager().reset();
propertyMap.clear();
objectMap.clear();
}
@@ -138,11 +153,49 @@ public class ContextBase implements Context {
}
public ExecutorService getExecutorService() {
- return executorService;
+ if (executorService == null) {
+ synchronized (this) {
+ if (executorService == null) {
+ executorService = ExecutorServiceUtil.newExecutorService();
+ }
+ }
+ }
+ return executorService;
+ }
+
+ private synchronized void stopExecutorService() {
+ if (executorService != null) {
+ ExecutorServiceUtil.shutdown(executorService);
+ executorService = null;
+ }
+ }
+
+ public void register(LifeCycle component) {
+ getLifeCycleManager().register(component);
}
+ /**
+ * Gets the life cycle manager for this context.
+ *
+ * The default implementation lazily initializes an instance of
+ * {@link LifeCycleManager}. Subclasses may override to provide a custom
+ * manager implementation, but must take care to return the same manager
+ * object for each call to this method.
+ *
+ * This is exposed primarily to support instrumentation for unit testing.
+ *
+ * @return manager object
+ */
+ synchronized LifeCycleManager getLifeCycleManager() {
+ if (lifeCycleManager == null) {
+ lifeCycleManager = new LifeCycleManager();
+ }
+ return lifeCycleManager;
+ }
+
@Override
public String toString() {
return name;
}
+
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java b/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
index 38ddc8547827cd76cb94ae2963a655d797bc0b09..0b426b0666ae7b5dd5286f2c7b0e5008703af864 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,8 +13,24 @@
*/
package ch.qos.logback.core;
+import ch.qos.logback.core.util.EnvUtil;
+
public class CoreConstants {
+ /**
+ * Number of idle threads to retain in a context's executor service.
+ */
+ // CORE_POOL_SIZE must be 1 for JDK 1.5. For JDK 1.6 or higher it's set to 0
+ // so that there are no idle threads
+ public static final int CORE_POOL_SIZE = EnvUtil.isJDK5() ? 1 : 0;
+
+ /**
+ * Maximum number of threads to allow in a context's executor service.
+ */
+ // if you need a different MAX_POOL_SIZE, please file create a jira issue
+ // asking to make MAX_POOL_SIZE a parameter.
+ public static final int MAX_POOL_SIZE = 32;
+
// Note that the line.separator property can be looked up even by
// applets.
public static final String LINE_SEPARATOR = System.getProperty("line.separator");
@@ -84,6 +100,7 @@ public class CoreConstants {
public static final char SINGLE_QUOTE_CHAR = '\'';
public static final char COLON_CHAR = ':';
public static final char DASH_CHAR = '-';
+ public static final String DEFAULT_VALUE_SEPARATOR = ":-";
/**
@@ -142,6 +159,11 @@ public class CoreConstants {
public static final int MILLIS_IN_ONE_DAY = MILLIS_IN_ONE_HOUR*24;
public static final int MILLIS_IN_ONE_WEEK = MILLIS_IN_ONE_DAY*7;
+ /**
+ * The number of seconds to wait for compression jobs to finish.
+ */
+ public static final int SECONDS_TO_WAIT_FOR_COMPRESSION_JOBS = 30;
+
public static final String CONTEXT_SCOPE_VALUE = "context";
public static final String RESET_MSG_PREFIX = "Will reset and reconfigure context ";
diff --git a/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java b/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
index b8c425d3e9e72d3a8137f733a8b0d435b2ec1052..409aa6c6b5f456289b45b4dc6f29a44f6610a485 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/Layout.java b/logback-core/src/main/java/ch/qos/logback/core/Layout.java
index 64d785adf3155b3877f12469bc2bbf6764e9f997..9e9a5685a8fe76e42941777f209418bc79dbfa3b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/Layout.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/Layout.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/LayoutBase.java b/logback-core/src/main/java/ch/qos/logback/core/LayoutBase.java
index 21daf3fbf541c8763d5617bf6c814729bbde503f..99f24bad43d856d7f45b2e5454b3d37457c33777 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/LayoutBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/LayoutBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/LifeCycleManager.java b/logback-core/src/main/java/ch/qos/logback/core/LifeCycleManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..5ba1c60e163c7c5fbcfe73e5d5a07fad4ec90954
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/LifeCycleManager.java
@@ -0,0 +1,56 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2011, 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.core;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import ch.qos.logback.core.spi.LifeCycle;
+
+/**
+ * An object that manages a collection of components that implement the
+ * {@link LifeCycle} interface. Each component that is added to the manager
+ * will be stopped and removed from the manager when the manager is reset.
+ *
+ * @author Carl Harris
+ */
+public class LifeCycleManager {
+
+ private final Set components = new HashSet();
+
+ /**
+ * Registers a component with this manager.
+ *
+ * @param component the component whose life cycle is to be managed
+ */
+ public void register(LifeCycle component) {
+ components.add(component);
+ }
+
+ /**
+ * Resets this manager.
+ *
+ * All registered components are stopped and removed from the manager.
+ */
+ public void reset() {
+ for (LifeCycle component : components) {
+ if (component.isStarted()) {
+ component.stop();
+ }
+ }
+ components.clear();
+ }
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/LogbackException.java b/logback-core/src/main/java/ch/qos/logback/core/LogbackException.java
index 79bc3ce5b51f7f37f905902f6e65afa46760f49c..47d08b445a944f777d9d738a3ea2cdb9c1c7a41e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/LogbackException.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/LogbackException.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java b/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
index 60fd6ce4bcd94e615f55cf16f1ead3e570566462..6bed3f3c720c71da938b549912dc6576e643abfe 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/PropertyDefinerBase.java b/logback-core/src/main/java/ch/qos/logback/core/PropertyDefinerBase.java
index c8d022e09a42d5df8d4e99d99b4400a7a4e5d7b7..03555c79558c7ad6bccd44b7515ed205cd21607c 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/PropertyDefinerBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/PropertyDefinerBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -17,10 +17,14 @@ import ch.qos.logback.core.spi.ContextAwareBase;
import ch.qos.logback.core.spi.PropertyDefiner;
/**
- * Set a skeleton implementation for property definers
- * just for have ContextAwareBase.
+ * A skeleton implementation for property definers so that they derive from {@link ContextAwareBase}.
*
* @author Aleksey Didik
*/
public abstract class PropertyDefinerBase extends ContextAwareBase implements PropertyDefiner {
+
+ static protected String booleanAsStr(boolean bool) {
+ return bool ? Boolean.TRUE.toString() : Boolean.FALSE.toString();
+ }
+
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/UnsynchronizedAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/UnsynchronizedAppenderBase.java
index 2bfaa94793000fe2220d8afb026361532b9dd4b5..2f924e6a5c109f626d6fc2653f938c5f0cd5572a 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/UnsynchronizedAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/UnsynchronizedAppenderBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/boolex/EvaluationException.java b/logback-core/src/main/java/ch/qos/logback/core/boolex/EvaluationException.java
index 5e44e0322fcb826f701f0eb597692f53bb099ff9..c1719296a1a448d50ce911625f3a90f7134dac22 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/boolex/EvaluationException.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/boolex/EvaluationException.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluator.java b/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluator.java
index 143be52fdf61f6d9c2255312499c0d38196908fa..30abf491df1fbf3aba249271dc76c76ca1320481 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluator.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluatorBase.java b/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluatorBase.java
index be382cef80b7a07c2d9a77e16940b23734686850..b380e63205f22260b7c0714616100c40eeb55e3f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluatorBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluatorBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/boolex/JaninoEventEvaluatorBase.java b/logback-core/src/main/java/ch/qos/logback/core/boolex/JaninoEventEvaluatorBase.java
index 235728149c6527c5314eccdef0fb98125d5dfffc..2fa92fdb377621dff4cf101bfaf2ca54cee18b48 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/boolex/JaninoEventEvaluatorBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/boolex/JaninoEventEvaluatorBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/boolex/Matcher.java b/logback-core/src/main/java/ch/qos/logback/core/boolex/Matcher.java
index 036637e6a59073828e38b42b9863cd8d1d172cf8..9e8f9afa3f75f72fccfbfdfb249828ec59c6e9e0 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/boolex/Matcher.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/boolex/Matcher.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/BindDataSourceToJNDIAction.java b/logback-core/src/main/java/ch/qos/logback/core/db/BindDataSourceToJNDIAction.java
index 945b6b7080d01aecffbc8b14d48adac317d1765a..ccac089d3cbeda3e40933e90bcdca289dfd20bf7 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/BindDataSourceToJNDIAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/BindDataSourceToJNDIAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSource.java b/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSource.java
index 5c03e5ff8d6137dfeca55343c6a086bd387ef612..9b066c25196cc383759f6089fa756834c1729abb 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSource.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSource.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSourceBase.java b/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSourceBase.java
index 00d5fb534ebe3bc6e06cba36ec549d1e38bd3e86..dd8f964e0e8ceefc584f4e993eb939cebf311f29 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSourceBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSourceBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
index 794e1d7234f1a33ac3e4186acac5bbc87597840d..c423bc9b56f0962f09eebe47b437ef06de3c1dd8 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DBHelper.java b/logback-core/src/main/java/ch/qos/logback/core/db/DBHelper.java
index dcd37fa4e4f5eb78341c1a8b6a7efcb12182eac5..867a28aba6a0b3afada3d5638a94425c409fda6a 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DBHelper.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DBHelper.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DataSourceConnectionSource.java b/logback-core/src/main/java/ch/qos/logback/core/db/DataSourceConnectionSource.java
index 75918ba13f081e2979f92bdbda2c9bf7aea2298e..3195241f2fb21b63d62aa5d1b5089ce374725cfd 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DataSourceConnectionSource.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DataSourceConnectionSource.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -41,16 +41,7 @@ public class DataSourceConnectionSource extends ConnectionSourceBase {
if (dataSource == null) {
addWarn("WARNING: No data source specified");
} else {
- Connection connection = null;
- try {
- connection = getConnection();
- } catch (SQLException se) {
- addWarn("Could not get a connection to discover the dialect to use.",
- se);
- }
- if (connection != null) {
- discoverConnectionProperties();
- }
+ discoverConnectionProperties();
if (!supportsGetGeneratedKeys()
&& getSQLDialectCode() == SQLDialectCode.UNKNOWN_DIALECT) {
addWarn("Connection does not support GetGeneratedKey method and could not discover the dialect.");
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DriverManagerConnectionSource.java b/logback-core/src/main/java/ch/qos/logback/core/db/DriverManagerConnectionSource.java
index 7ff42feb9d4adffd5434639f2581d35175202ea2..d7729bf86daf1de254716ad413255707f159be4f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DriverManagerConnectionSource.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DriverManagerConnectionSource.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/JNDIConnectionSource.java b/logback-core/src/main/java/ch/qos/logback/core/db/JNDIConnectionSource.java
index f0ef9fd00e40fa63bf33af275681f6f9a1103afc..c2e58c1f6a803c20f5a937cd78ff9a5688282e58 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/JNDIConnectionSource.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/JNDIConnectionSource.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/DBUtil.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/DBUtil.java
index 670f92c6014ca093bc3cfa525f47b7a8934b1ec0..cd264dc192901a29de32afc74a3ee48793ad9588 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/DBUtil.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/DBUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/H2Dialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/H2Dialect.java
index 9955f1d280f7ceb161ae0ebd3182ebb52ca8de06..fdde6e740f1bca752be1166986e8e15ad14af307 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/H2Dialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/H2Dialect.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/HSQLDBDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/HSQLDBDialect.java
index 53f8abe80deaf163f3810371b8cdfa5de107d547..4b4dd440ef750f0323a0796ada4f2898dec5300e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/HSQLDBDialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/HSQLDBDialect.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/MsSQLDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/MsSQLDialect.java
index 191167cfadad6a29ce377839f012319d841a928a..211c5197dcd00e3be7ed88e54251d61247778d79 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/MsSQLDialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/MsSQLDialect.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/MySQLDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/MySQLDialect.java
index ede5f37a37b07ae433a84b1969ca5f880bf96c78..04b182e346044bdc7549be1c99bf6aa2c5a2dc21 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/MySQLDialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/MySQLDialect.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/OracleDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/OracleDialect.java
index c8036513fd730a0f6f12b58f2db7ac725ac48ee3..d9e517fc405ef02788441a33ebe16d23e5e0e5b8 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/OracleDialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/OracleDialect.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/PostgreSQLDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/PostgreSQLDialect.java
index 5be17edf6982fa8d5c7eb66ede44cadc513e446f..4bdb124a5898dafe8a6145eca8dad23c21830af9 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/PostgreSQLDialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/PostgreSQLDialect.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialect.java
index 3244a34cb4f9235c24cc14cb7cc5eaf6254330ab..2e69ed5dfd95b5948ef9e6813aeb01567564961f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialect.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialectCode.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialectCode.java
index 9a09f32789e2ab831c4ba369abf6fc921f64ad93..a423764d46189ef4585f4504c6d9543fdeb02977 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialectCode.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialectCode.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLiteDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLiteDialect.java
index fa43960a2e5a82b8c85823a497119145d3e27632..467b024fc9dc245dbcf1f87dfbe798670538381b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLiteDialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLiteDialect.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2012, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -11,7 +11,6 @@
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
-
package ch.qos.logback.core.db.dialect;
/**
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SybaseSqlAnywhereDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SybaseSqlAnywhereDialect.java
index 7ec7f77768415d465f1cd3f9886cf91e23ff5013..bce03152ebc4f712156d8130b3228adb750d4489 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SybaseSqlAnywhereDialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SybaseSqlAnywhereDialect.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/ByteArrayUtil.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/ByteArrayUtil.java
index 5bcb6f55e745d95dbfc8379cc219ae9fd6e164be..0cc44f64a38a58b1dbe4f041bb4b32576d806938 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/ByteArrayUtil.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/ByteArrayUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java
index 0ac7d31f5e8a017ff1f95feeb21f8f9706b1f97d..d561043726bc89949239948148aacde5eb079091 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java
index ce5e22b76527b844c744f988768b03eba5270996..7eed74f8c77a98a184938c77f9f309989508871d 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java
index 0e7187084394f2ea4a2d472288df466ce9a7c5e4..ce4ac05ea3b0db54c2cdd3d8f2023ca4c6ab59cc 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java
index 558e2355d016726d8103faf9db9e7fb029fa771d..df03480e2b69459cd803c2e1a219fa22d4343a3d 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java
index e7ac7aa142e16665b66b17aa8df4b48576ed2d7f..d2daccbbe44ce437f22de9ce74c2387963f86f34 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/NonClosableInputStream.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/NonClosableInputStream.java
index 08525f08357b7a5ddd0bd175a6e256f9f0bf9cfd..3bcffd7db4bfbb668a3329475f622ff265309a07 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/NonClosableInputStream.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/NonClosableInputStream.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java
index ee5932d05956bc6899ab13a56f3eb8777a9d5f09..a5e19642d2e1198f8cc2cd9df273f97c4450e707 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/filter/AbstractMatcherFilter.java b/logback-core/src/main/java/ch/qos/logback/core/filter/AbstractMatcherFilter.java
index 63f0f5727845567bb26dc16aaaaeddf817f6fa04..79db1519b0d57625685e7e84eceb3be75c6ea574 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/filter/AbstractMatcherFilter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/filter/AbstractMatcherFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java b/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java
index 827d928d11e9b9ab4a054340f32fe22105b2f423..e3275779f7aeeda9f26d12a37e8a37e87bfe74e3 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/filter/Filter.java b/logback-core/src/main/java/ch/qos/logback/core/filter/Filter.java
index 063106b2a7ae2f1e7670a588113f59af3b8628fd..f4bde77fb83fb1437979485c3fbceb909cd3edd4 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/filter/Filter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/filter/Filter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/helpers/CyclicBuffer.java b/logback-core/src/main/java/ch/qos/logback/core/helpers/CyclicBuffer.java
index 6e92600ffbd7caf2e2e7afa3e23c7a64313001eb..1eee0e585c3c1ae4fcfb0b4a0f8c1fbba2c1d1de 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/helpers/CyclicBuffer.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/helpers/CyclicBuffer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/helpers/NOPAppender.java b/logback-core/src/main/java/ch/qos/logback/core/helpers/NOPAppender.java
index ebda3d10b07b8908b3a096d74ebb2aad77e6d73f..3b9b08d60ae28d2ea1a067574e2fe650d1dd5df0 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/helpers/NOPAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/helpers/NOPAppender.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/helpers/ThrowableToStringArray.java b/logback-core/src/main/java/ch/qos/logback/core/helpers/ThrowableToStringArray.java
index 4bbcde527f128fa7903e6e8ebb48b754dd236bcb..6e549eb3284190dd30df4b45aa92ce0014fb07b9 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/helpers/ThrowableToStringArray.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/helpers/ThrowableToStringArray.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/helpers/Transform.java b/logback-core/src/main/java/ch/qos/logback/core/helpers/Transform.java
index 57c0da5c0248311f1db66295f6db124d5222487a..59d6def29a9f9ea7c2926976080160b67b78809b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/helpers/Transform.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/helpers/Transform.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/html/CssBuilder.java b/logback-core/src/main/java/ch/qos/logback/core/html/CssBuilder.java
index 6dd7a1d23ae98c9736fac27f1dd8f66f7dbce89e..5fbcd12d6e2b5dde1b9842ae6707da0643ac710e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/html/CssBuilder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/html/CssBuilder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/html/HTMLLayoutBase.java b/logback-core/src/main/java/ch/qos/logback/core/html/HTMLLayoutBase.java
index 099c32c69dfebc5fc331c14756c42b79d26ac337..60dd2402c0e74439b6dcce6f9a22dd484c9a911e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/html/HTMLLayoutBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/html/HTMLLayoutBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/html/IThrowableRenderer.java b/logback-core/src/main/java/ch/qos/logback/core/html/IThrowableRenderer.java
index 874041e9740dbfef698f1899e45ceca7553da071..1110038eb92649fcf4f65d5725433f215fb4b130 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/html/IThrowableRenderer.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/html/IThrowableRenderer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/html/NOPThrowableRenderer.java b/logback-core/src/main/java/ch/qos/logback/core/html/NOPThrowableRenderer.java
index 8a53d73e37c88a5d1fd41338b5681d1cf21dbbc8..a3d5dfe8d5f179152aa43c2ae6a9cf0632ad98d8 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/html/NOPThrowableRenderer.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/html/NOPThrowableRenderer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java b/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java
index 5edc47c1f33053868382ef90c600e32b69501430..54a38c54552bedce32e503ff649a06b299dc515b 100755
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -107,14 +107,14 @@ public abstract class GenericConfigurator extends ContextAwareBase {
}
- protected Pattern initialPattern() {
- return new Pattern();
+ protected ElementPath initialElementPath() {
+ return new ElementPath();
}
protected void buildInterpreter() {
RuleStore rs = new SimpleRuleStore(context);
addInstanceRules(rs);
- this.interpreter = new Interpreter(context, rs, initialPattern());
+ this.interpreter = new Interpreter(context, rs, initialElementPath());
InterpretationContext interpretationContext = interpreter.getInterpretationContext();
interpretationContext.setContext(context);
addImplicitRules(interpreter);
@@ -130,8 +130,7 @@ public abstract class GenericConfigurator extends ContextAwareBase {
if (!ConfigurationWatchListUtil.wasConfigurationWatchListReset(context)) {
informContextOfURLUsedForConfiguration(getContext(), null);
}
- SaxEventRecorder recorder = new SaxEventRecorder();
- recorder.setContext(context);
+ SaxEventRecorder recorder = new SaxEventRecorder(context);
recorder.recordEvents(inputSource);
doConfigure(recorder.saxEventList);
// no exceptions a this level
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/JoranConfiguratorBase.java b/logback-core/src/main/java/ch/qos/logback/core/joran/JoranConfiguratorBase.java
index cb9768267e444e84187b4a7e3e5a4cfdb96705e0..50db8b5307dd91cc7343c6235c89ed0048ddc543 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/JoranConfiguratorBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/JoranConfiguratorBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -30,9 +30,9 @@ import ch.qos.logback.core.joran.action.ParamAction;
import ch.qos.logback.core.joran.action.PropertyAction;
import ch.qos.logback.core.joran.action.StatusListenerAction;
import ch.qos.logback.core.joran.action.TimestampAction;
+import ch.qos.logback.core.joran.spi.ElementSelector;
import ch.qos.logback.core.joran.spi.InterpretationContext;
import ch.qos.logback.core.joran.spi.Interpreter;
-import ch.qos.logback.core.joran.spi.Pattern;
import ch.qos.logback.core.joran.spi.RuleStore;
// Based on 310985 revision 310985 as attested by http://tinyurl.com/8njps
@@ -57,32 +57,33 @@ abstract public class JoranConfiguratorBase extends GenericConfigurator {
@Override
protected void addInstanceRules(RuleStore rs) {
- rs.addRule(new Pattern("configuration/variable"), new PropertyAction());
- rs.addRule(new Pattern("configuration/property"), new PropertyAction());
+ // is "configuration/variable" referenced in the docs?
+ rs.addRule(new ElementSelector("configuration/variable"), new PropertyAction());
+ rs.addRule(new ElementSelector("configuration/property"), new PropertyAction());
- rs.addRule(new Pattern("configuration/substitutionProperty"),
+ rs.addRule(new ElementSelector("configuration/substitutionProperty"),
new PropertyAction());
- rs.addRule(new Pattern("configuration/timestamp"), new TimestampAction());
+ rs.addRule(new ElementSelector("configuration/timestamp"), new TimestampAction());
- rs.addRule(new Pattern("configuration/define"), new DefinePropertyAction());
+ rs.addRule(new ElementSelector("configuration/define"), new DefinePropertyAction());
// the contextProperty pattern is deprecated. It is undocumented
// and will be dropped in future versions of logback
- rs.addRule(new Pattern("configuration/contextProperty"),
+ rs.addRule(new ElementSelector("configuration/contextProperty"),
new ContextPropertyAction());
- rs.addRule(new Pattern("configuration/conversionRule"),
+ rs.addRule(new ElementSelector("configuration/conversionRule"),
new ConversionRuleAction());
- rs.addRule(new Pattern("configuration/statusListener"),
+ rs.addRule(new ElementSelector("configuration/statusListener"),
new StatusListenerAction());
- rs.addRule(new Pattern("configuration/appender"), new AppenderAction());
- rs.addRule(new Pattern("configuration/appender/appender-ref"),
+ rs.addRule(new ElementSelector("configuration/appender"), new AppenderAction());
+ rs.addRule(new ElementSelector("configuration/appender/appender-ref"),
new AppenderRefAction());
- rs.addRule(new Pattern("configuration/newRule"), new NewRuleAction());
- rs.addRule(new Pattern("*/param"), new ParamAction());
+ rs.addRule(new ElementSelector("configuration/newRule"), new NewRuleAction());
+ rs.addRule(new ElementSelector("*/param"), new ParamAction());
}
@Override
@@ -106,7 +107,7 @@ abstract public class JoranConfiguratorBase extends GenericConfigurator {
omap.put(ActionConst.FILTER_CHAIN_BAG, new HashMap());
}
- public InterpretationContext getExecutionContext() {
+ public InterpretationContext getInterpretationContext() {
return interpreter.getInterpretationContext();
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/AbstractEventEvaluatorAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/AbstractEventEvaluatorAction.java
index 64bbe7ddfd335317d6d7754eef91ffb5aefdc92b..210a39a425f8c2d3f35bd0dd4468e43b380407a3 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/AbstractEventEvaluatorAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/AbstractEventEvaluatorAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java
index 5089a4719d88ebda2380893db104c902db73dde4..494187daee8c61dd211e9cbda1d217f47803cdd5 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -50,7 +50,7 @@ public abstract class Action extends ContextAwareBase {
/**
* Called when the parser encounters an element matching a
- * {@link ch.qos.logback.core.joran.spi.Pattern Pattern}.
+ * {@link ch.qos.logback.core.joran.spi.ElementSelector Pattern}.
*/
public abstract void begin(InterpretationContext ic, String name,
Attributes attributes) throws ActionException;
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionConst.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionConst.java
index 66b4fc1afb3ef78c210283eb2493f307cd8a784e..c0b7fe507bd1b8f8ede167451c81636e8df4b1c8 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionConst.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionConst.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionUtil.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionUtil.java
index 370a182620d699bda05f495fb39f2bac5dfcb8f8..0cb13b026d57d6a36320780b046f0d722f93a624 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionUtil.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ActionUtil.java
@@ -1,3 +1,16 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2013, 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.core.joran.action;
import java.util.Properties;
@@ -12,6 +25,11 @@ public class ActionUtil {
LOCAL, CONTEXT, SYSTEM
};
+ /**
+ * Convert a string into a scope. Scole.LOCAL is returned by default.
+ * @param scopeStr
+ * @return a scope corresponding to the input string; Scope.LOCAL by default.
+ */
static public Scope stringToScope(String scopeStr) {
if(Scope.SYSTEM.toString().equalsIgnoreCase(scopeStr))
return Scope.SYSTEM;
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/AppenderAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/AppenderAction.java
index f0ee3b289670b8db5597d5cbe7da185c12361822..7ccab3059e8b715691bd9864b836b7eb2eecc7da 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/AppenderAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/AppenderAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/AppenderRefAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/AppenderRefAction.java
index 1ed63f1d9fb0c2014011d73f6e4f13796f6f29f6..95ade659df36196e0c0be5b3b4ee1df261196bfc 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/AppenderRefAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/AppenderRefAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ContextPropertyAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ContextPropertyAction.java
index 5970d63773419adb3c7df074d92677b94b39239b..ce793c08c29a5cbbe1d198662e5e2ed1d93ca863 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ContextPropertyAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ContextPropertyAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ConversionRuleAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ConversionRuleAction.java
index 95d71c6d8587c0d58377310bf93bf02977ae4880..a01bf23ac992b2ec99441433e65041e1c5cbf4a7 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ConversionRuleAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ConversionRuleAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/DefinePropertyAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/DefinePropertyAction.java
index cb03fcc4b3e618a3aadf6abd1365ed995f8be099..aced27c0ba8a597f89c49a9d6ffa56be013fad6b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/DefinePropertyAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/DefinePropertyAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/IADataForBasicProperty.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/IADataForBasicProperty.java
index 9e9882b158c3471c6a23797bd2024f0b6e61ecf4..8275f1421664e0f165366bbe3db4087349fbd64c 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/IADataForBasicProperty.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/IADataForBasicProperty.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/IADataForComplexProperty.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/IADataForComplexProperty.java
index 424e0164ee6e6a38cdefdfe22c68a1306a223b2e..5db16baf1b5df3ee94a49e69fe62250cb172310d 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/IADataForComplexProperty.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/IADataForComplexProperty.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ImplicitAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ImplicitAction.java
index 0f4744eed65309341b9ad20c03acd6e913101af4..3d5a6155cfd17b1f685b2aa453bf8984fb65bd83 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ImplicitAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ImplicitAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -14,10 +14,10 @@
package ch.qos.logback.core.joran.action;
+import ch.qos.logback.core.joran.spi.ElementPath;
import org.xml.sax.Attributes;
import ch.qos.logback.core.joran.spi.InterpretationContext;
-import ch.qos.logback.core.joran.spi.Pattern;
/**
@@ -34,14 +34,14 @@ public abstract class ImplicitAction extends Action {
/**
* Check whether this implicit action is appropriate in the current context.
*
- * @param currentPattern This pattern contains the tag name of the current
+ * @param currentElementPath This pattern contains the tag name of the current
* element being parsed at the top of the stack.
* @param attributes The attributes of the current element to process.
* @param ec
* @return Whether the implicit action is applicable in the current context
*/
public abstract boolean isApplicable(
- Pattern currentPattern, Attributes attributes, InterpretationContext ec);
+ ElementPath currentElementPath, Attributes attributes, InterpretationContext ec);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/IncludeAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/IncludeAction.java
index 275d981d46af8e380d0cf996734e0f382b145e34..8bc0c4238d7ef254f4debdaefe9d72442f2aa99a 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/IncludeAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/IncludeAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -39,16 +39,19 @@ public class IncludeAction extends Action {
private static final String FILE_ATTR = "file";
private static final String URL_ATTR = "url";
private static final String RESOURCE_ATTR = "resource";
+ private static final String OPTIONAL_ATTR = "optional";
private String attributeInUse;
+ private boolean optional;
@Override
public void begin(InterpretationContext ec, String name, Attributes attributes)
throws ActionException {
- SaxEventRecorder recorder = new SaxEventRecorder();
+ SaxEventRecorder recorder = new SaxEventRecorder(context);
this.attributeInUse = null;
+ this.optional = OptionHelper.toBoolean(attributes.getValue(OPTIONAL_ATTR), false);
if (!checkAttributes(attributes)) {
return;
@@ -140,8 +143,10 @@ public class IncludeAction extends Action {
try {
return url.openStream();
} catch (IOException e) {
- String errMsg = "Failed to open [" + url.toString() + "]";
- addError(errMsg, e);
+ if (!optional) {
+ String errMsg = "Failed to open [" + url.toString() + "]";
+ addError(errMsg, e);
+ }
return null;
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/NOPAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/NOPAction.java
index d034a85e989c62849231a2e6aac66c2bfbf77fae..0c0c705f2c678c57779060cb1f03a00c867f099c 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/NOPAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/NOPAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedBasicPropertyIA.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedBasicPropertyIA.java
index f1ff1eb73e0659288ddf5a9d1554dc6d47b6781c..62df428ba5ddd9ccdaba2edde35d4ce774b26826 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedBasicPropertyIA.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedBasicPropertyIA.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -15,10 +15,10 @@ package ch.qos.logback.core.joran.action;
import java.util.Stack;
+import ch.qos.logback.core.joran.spi.ElementPath;
import org.xml.sax.Attributes;
import ch.qos.logback.core.joran.spi.InterpretationContext;
-import ch.qos.logback.core.joran.spi.Pattern;
import ch.qos.logback.core.joran.util.PropertySetter;
import ch.qos.logback.core.util.AggregationType;
@@ -40,11 +40,11 @@ public class NestedBasicPropertyIA extends ImplicitAction {
// be followed by the corresponding pop.
Stack actionDataStack = new Stack();
- public boolean isApplicable(Pattern pattern, Attributes attributes,
+ public boolean isApplicable(ElementPath elementPath, Attributes attributes,
InterpretationContext ec) {
// System.out.println("in NestedSimplePropertyIA.isApplicable [" + pattern +
// "]");
- String nestedElementTagName = pattern.peekLast();
+ String nestedElementTagName = elementPath.peekLast();
// no point in attempting if there is no parent object
if (ec.isEmpty()) {
@@ -85,7 +85,6 @@ public class NestedBasicPropertyIA extends ImplicitAction {
public void body(InterpretationContext ec, String body) {
String finalBody = ec.subst(body);
- // System.out.println("body "+body+", finalBody="+finalBody);
// get the action data object pushed in isApplicable() method call
IADataForBasicProperty actionData = (IADataForBasicProperty) actionDataStack.peek();
switch (actionData.aggregationType) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedComplexPropertyIA.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedComplexPropertyIA.java
index d6a9c3ab5ffc38c8df10bb5455a8ef3600a2740f..5bd32060c4e6430c46629fe2ce60df44dbe98c97 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedComplexPropertyIA.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedComplexPropertyIA.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -15,11 +15,11 @@ package ch.qos.logback.core.joran.action;
import java.util.Stack;
+import ch.qos.logback.core.joran.spi.ElementPath;
import org.xml.sax.Attributes;
import ch.qos.logback.core.joran.spi.InterpretationContext;
import ch.qos.logback.core.joran.spi.NoAutoStartUtil;
-import ch.qos.logback.core.joran.spi.Pattern;
import ch.qos.logback.core.joran.util.PropertySetter;
import ch.qos.logback.core.spi.ContextAware;
import ch.qos.logback.core.spi.LifeCycle;
@@ -44,10 +44,10 @@ public class NestedComplexPropertyIA extends ImplicitAction {
// be followed by a corresponding pop.
Stack actionDataStack = new Stack();
- public boolean isApplicable(Pattern pattern, Attributes attributes,
+ public boolean isApplicable(ElementPath elementPath, Attributes attributes,
InterpretationContext ic) {
- String nestedElementTagName = pattern.peekLast();
+ String nestedElementTagName = elementPath.peekLast();
// calling ic.peekObject with an empty stack will throw an exception
if (ic.isEmpty()) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/NewRuleAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/NewRuleAction.java
index e8c85158f76b6d592fec2d2e800966179cc8331a..11c0509d946f9b7d63b5410093975042156634d4 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/NewRuleAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/NewRuleAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -16,7 +16,7 @@ package ch.qos.logback.core.joran.action;
import org.xml.sax.Attributes;
import ch.qos.logback.core.joran.spi.InterpretationContext;
-import ch.qos.logback.core.joran.spi.Pattern;
+import ch.qos.logback.core.joran.spi.ElementSelector;
import ch.qos.logback.core.util.OptionHelper;
@@ -50,7 +50,7 @@ public class NewRuleAction extends Action {
try {
addInfo("About to add new Joran parsing rule [" + pattern + ","
+ actionClass + "].");
- ec.getJoranInterpreter().getRuleStore().addRule(new Pattern(pattern),
+ ec.getJoranInterpreter().getRuleStore().addRule(new ElementSelector(pattern),
actionClass);
} catch (Exception oops) {
inError = true;
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ParamAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ParamAction.java
index 701d6097981a771fd9eab418b5c5bee4cafda742..e9167bd77289108b4f6becf3298acbbb4736e526 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/ParamAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/ParamAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/PropertyAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/PropertyAction.java
index 087647708f3e1164226331787a9e6d6d99412ddd..8a8411034f7f260ba07cf1b98842052b509f8fa1 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/PropertyAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/PropertyAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/StatusListenerAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/StatusListenerAction.java
index af8552273f68d4e1b2f59e77f32eab34959c9e17..516a5e202c9fd045e1cc94aa38f1753517a2a3b4 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/StatusListenerAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/StatusListenerAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java
index 371b0d8c74c988bd17100353584d051464afe155..262b8ad0c80b90b853eaad5b9cc0ee6b96edbe4e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -16,6 +16,7 @@ package ch.qos.logback.core.joran.action;
import ch.qos.logback.core.util.CachingDateFormatter;
import org.xml.sax.Attributes;
+import ch.qos.logback.core.joran.action.ActionUtil.Scope;
import ch.qos.logback.core.joran.spi.ActionException;
import ch.qos.logback.core.joran.spi.InterpretationContext;
import ch.qos.logback.core.util.OptionHelper;
@@ -64,12 +65,15 @@ public class TimestampAction extends Action {
if (inError)
return;
+ String scopeStr = attributes.getValue(SCOPE_ATTRIBUTE);
+ Scope scope = ActionUtil.stringToScope(scopeStr);
+
CachingDateFormatter sdf = new CachingDateFormatter(datePatternStr);
String val = sdf.format(timeReference);
addInfo("Adding property to the context with key=\"" + keyStr
- + "\" and value=\"" + val + "\" to the context");
- context.putProperty(keyStr, val);
+ + "\" and value=\"" + val + "\" to the " + scope + " scope");
+ ActionUtil.setProperty(ec, keyStr, val, scope);
}
@Override
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/Condition.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/Condition.java
index 5f6a11320670190b576bc3f7558a30ae8cf73746..595ca7247369a122c3d406249ece6040c0215f87 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/Condition.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/Condition.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ElseAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ElseAction.java
index 43e04b0c22ef08f6be6b505093862b72d4cdada8..d2eda56986adc355fecb7a642fe8a37054fc93e9 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ElseAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ElseAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java
index 4910ba1a2687ada0740787f0529775c2c4aee935..2c93fa717776ecc4ac03fe15e0ba71a6a9a92935 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/IfAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java
index 263b101ad84b91a0b5548d05a0a4be132adc4b4d..66259a80ae14ec6d154030019378fdaf0c4dc6a4 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyEvalScriptBuilder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyWrapperForScripts.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyWrapperForScripts.java
index fd832a903d044598f46d90550747d6beb8317970..8eb495cebaceb01d2d73cc5e63f900c23074e630 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyWrapperForScripts.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyWrapperForScripts.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenAction.java
index d8a44c16d132d40f7aca4370d7f35477dd91dd21..2cc5268d89fa24268a12134040f418718386bbd5 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenAction.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenOrElseActionBase.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenOrElseActionBase.java
index 4598161ca553421ab5271f0d889d1681813e8f19..a8ae8aafe942e207f0c8ce72e5352e8e2e032ae3 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenOrElseActionBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/ThenOrElseActionBase.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/BodyEvent.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/BodyEvent.java
index 7eec4b42d34e2e9dd82d5f0d7f14aa2c1bd16e24..9a5d0f3025399b6e4fdcb6c658b8eb1112fcdd91 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/event/BodyEvent.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/BodyEvent.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/EndEvent.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/EndEvent.java
index 41ce17d6a00d6f57c258249527ed681944d7cd01..dec649ec32e51e5d472c732582cb056133a16a87 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/event/EndEvent.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/EndEvent.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/InPlayListener.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/InPlayListener.java
index 47b0fedc91a133decb2325060d521c651024a9ed..978096adf7b5b588e127b0ed53e4db4e7b36d2d6 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/event/InPlayListener.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/InPlayListener.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/SaxEvent.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/SaxEvent.java
index a5ca412b314f60c31f5d80d8453bc12a9cef78d6..92399435bb82fa53921c4a2970013326f70efeff 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/event/SaxEvent.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/SaxEvent.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/SaxEventRecorder.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/SaxEventRecorder.java
index 45bb694607dd5c60e9ff2455726dbc47361e3411..27cfa7c18e2afce9181111e28162b28bb4aad78a 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/event/SaxEventRecorder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/SaxEventRecorder.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -22,6 +22,9 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import static ch.qos.logback.core.CoreConstants.XML_PARSING;
+
+import ch.qos.logback.core.joran.spi.ElementPath;
+import ch.qos.logback.core.joran.spi.ElementSelector;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
@@ -31,7 +34,6 @@ import org.xml.sax.helpers.DefaultHandler;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.joran.spi.JoranException;
-import ch.qos.logback.core.joran.spi.Pattern;
import ch.qos.logback.core.spi.ContextAware;
import ch.qos.logback.core.spi.ContextAwareImpl;
import ch.qos.logback.core.status.Status;
@@ -40,13 +42,13 @@ public class SaxEventRecorder extends DefaultHandler implements ContextAware {
final ContextAwareImpl cai;
- public SaxEventRecorder() {
- cai = new ContextAwareImpl(this);
+ public SaxEventRecorder(Context context) {
+ cai = new ContextAwareImpl(context, this);
}
public List saxEventList = new ArrayList();
Locator locator;
- Pattern globalPattern = new Pattern();
+ ElementPath globalElementPath = new ElementPath();
final public void recordEvents(InputStream inputStream) throws JoranException {
recordEvents(new InputSource(inputStream));
@@ -102,8 +104,8 @@ public class SaxEventRecorder extends DefaultHandler implements ContextAware {
Attributes atts) {
String tagName = getTagName(localName, qName);
- globalPattern.push(tagName);
- Pattern current = (Pattern) globalPattern.clone();
+ globalElementPath.push(tagName);
+ ElementPath current = globalElementPath.duplicate();
saxEventList.add(new StartEvent(current, namespaceURI, localName, qName,
atts, getLocator()));
}
@@ -138,7 +140,7 @@ public class SaxEventRecorder extends DefaultHandler implements ContextAware {
public void endElement(String namespaceURI, String localName, String qName) {
saxEventList
.add(new EndEvent(namespaceURI, localName, qName, getLocator()));
- globalPattern.pop();
+ globalElementPath.pop();
}
String getTagName(String localName, String qName) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/StartEvent.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/StartEvent.java
index d76c50fdd4e5717245b712c30cf25fd328eef381..4ce7c108e8c6879e7527cd9e0cc58f7b7fd0d12a 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/event/StartEvent.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/StartEvent.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -13,23 +13,22 @@
*/
package ch.qos.logback.core.joran.event;
+import ch.qos.logback.core.joran.spi.ElementPath;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.helpers.AttributesImpl;
-import ch.qos.logback.core.joran.spi.Pattern;
-
public class StartEvent extends SaxEvent {
final public Attributes attributes;
- final public Pattern pattern;
+ final public ElementPath elementPath;
- StartEvent(Pattern pattern, String namespaceURI, String localName, String qName,
+ StartEvent(ElementPath elementPath, String namespaceURI, String localName, String qName,
Attributes attributes, Locator locator) {
super(namespaceURI, localName, qName, locator);
// locator impl is used to take a snapshot!
this.attributes = new AttributesImpl(attributes);
- this.pattern = pattern;
+ this.elementPath = elementPath;
}
public Attributes getAttributes() {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/BodyEvent.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/BodyEvent.java
new file mode 100755
index 0000000000000000000000000000000000000000..0ca762986aa2a761fee47a30b1b6b5653c5df788
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/BodyEvent.java
@@ -0,0 +1,28 @@
+package ch.qos.logback.core.joran.event.stax;
+
+import javax.xml.stream.Location;
+
+public class BodyEvent extends StaxEvent {
+
+
+ private String text;
+
+ BodyEvent(String text, Location location) {
+ super(null, location);
+ this.text = text;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ void append(String txt) {
+ text += txt;
+ }
+
+ @Override
+ public String toString() {
+ return "BodyEvent(" + getText() + ")" + location.getLineNumber() + ","
+ + location.getColumnNumber();
+ }
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/EndEvent.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/EndEvent.java
new file mode 100755
index 0000000000000000000000000000000000000000..a11fd73ae024eed148d76429c652ae54c8fb525e
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/EndEvent.java
@@ -0,0 +1,24 @@
+package ch.qos.logback.core.joran.event.stax;
+
+import javax.xml.stream.Location;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: ceki
+ * Date: 7/2/13
+ * Time: 4:07 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class EndEvent extends StaxEvent {
+
+ public EndEvent(String name, Location location) {
+ super(name, location);
+ }
+
+ @Override
+ public String toString() {
+ return "EndEvent("+getName()+") ["+location.getLineNumber()+","+location.getColumnNumber()+"]";
+ }
+
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/StartEvent.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/StartEvent.java
new file mode 100755
index 0000000000000000000000000000000000000000..7b60d2fc5f171dc90faac785afffd664484e858c
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/StartEvent.java
@@ -0,0 +1,54 @@
+package ch.qos.logback.core.joran.event.stax;
+
+import ch.qos.logback.core.joran.spi.ElementPath;
+
+import javax.xml.stream.Location;
+import javax.xml.stream.events.Attribute;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class StartEvent extends StaxEvent {
+
+ List attributes;
+ public ElementPath elementPath;
+
+ StartEvent(ElementPath elementPath, String name, Iterator attributeIterator, Location location) {
+ super(name, location);
+ populateAttributes(attributeIterator);
+ this.elementPath = elementPath;
+ }
+
+ private void populateAttributes(Iterator attributeIterator) {
+ while (attributeIterator.hasNext()) {
+ if (attributes == null) {
+ attributes = new ArrayList(2);
+ }
+ attributes.add(attributeIterator.next());
+ }
+ }
+
+ public ElementPath getElementPath() {
+ return elementPath;
+ }
+
+ public List getAttributeList() {
+ return attributes;
+ }
+
+ Attribute getAttributeByName(String name) {
+ if(attributes == null)
+ return null;
+
+ for(Attribute attr: attributes) {
+ if(name.equals(attr.getName().getLocalPart()))
+ return attr;
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return "StartEvent(" + getName() + ") [" + location.getLineNumber() + "," + location.getColumnNumber() + "]";
+ }
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/StaxEvent.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/StaxEvent.java
new file mode 100755
index 0000000000000000000000000000000000000000..da341fa5889fb4336253b4b8a5170d2c6427648e
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/StaxEvent.java
@@ -0,0 +1,25 @@
+package ch.qos.logback.core.joran.event.stax;
+
+
+import javax.xml.stream.Location;
+
+public class StaxEvent {
+
+ final String name;
+ final Location location;
+
+ StaxEvent(String name, Location location) {
+ this.name = name;
+ this.location = location;
+
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Location getLocation() {
+ return location;
+ }
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/StaxEventRecorder.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/StaxEventRecorder.java
new file mode 100755
index 0000000000000000000000000000000000000000..cdfc385eea3d94c00feb3a59778c0568e1c0e22a
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/stax/StaxEventRecorder.java
@@ -0,0 +1,103 @@
+package ch.qos.logback.core.joran.event.stax;
+
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.joran.spi.ElementPath;
+import ch.qos.logback.core.joran.spi.JoranException;
+import ch.qos.logback.core.spi.ContextAwareBase;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Characters;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class StaxEventRecorder extends ContextAwareBase {
+
+ List eventList = new ArrayList();
+ ElementPath globalElementPath = new ElementPath();
+
+ public StaxEventRecorder(Context context) {
+ setContext(context);
+ }
+
+ public void recordEvents(InputStream inputStream) throws JoranException {
+ try {
+ XMLEventReader xmlEventReader = XMLInputFactory.newInstance().createXMLEventReader(inputStream);
+ read(xmlEventReader);
+ } catch (XMLStreamException e) {
+ throw new JoranException("Problem parsing XML document. See previously reported errors.", e);
+ }
+ }
+
+ public List getEventList() {
+ return eventList;
+ }
+
+ private void read(XMLEventReader xmlEventReader) throws XMLStreamException {
+ while (xmlEventReader.hasNext()) {
+ XMLEvent xmlEvent = xmlEventReader.nextEvent();
+ switch (xmlEvent.getEventType()) {
+ case XMLEvent.START_ELEMENT:
+ addStartElement(xmlEvent);
+ break;
+ case XMLEvent.CHARACTERS:
+ addCharacters(xmlEvent);
+ break;
+ case XMLEvent.END_ELEMENT:
+ addEndEvent(xmlEvent);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ private void addStartElement(XMLEvent xmlEvent) {
+ StartElement se = xmlEvent.asStartElement();
+ String tagName = se.getName().getLocalPart();
+ globalElementPath.push(tagName);
+ ElementPath current = globalElementPath.duplicate();
+ StartEvent startEvent = new StartEvent(current, tagName, se.getAttributes(), se.getLocation());
+ eventList.add(startEvent);
+ }
+
+ private void addCharacters(XMLEvent xmlEvent) {
+ Characters characters = xmlEvent.asCharacters();
+ StaxEvent lastEvent = getLastEvent();
+
+ if (lastEvent instanceof BodyEvent) {
+ BodyEvent be = (BodyEvent) lastEvent;
+ be.append(characters.getData());
+ } else {
+ // ignore space only text if the previous event is not a BodyEvent
+ if(!characters.isWhiteSpace()) {
+ BodyEvent bodyEvent = new BodyEvent(characters.getData(), xmlEvent.getLocation());
+ eventList.add(bodyEvent);
+ }
+ }
+ }
+
+ private void addEndEvent(XMLEvent xmlEvent) {
+ EndElement ee = xmlEvent.asEndElement();
+ String tagName = ee.getName().getLocalPart();
+ EndEvent endEvent = new EndEvent(tagName, ee.getLocation());
+ eventList.add(endEvent);
+ globalElementPath.pop();
+ }
+
+ StaxEvent getLastEvent() {
+ if (eventList.isEmpty()) {
+ return null;
+ }
+ int size = eventList.size();
+ if(size == 0)
+ return null;
+ return eventList.get(size - 1);
+ }
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/node/ComponentNode.java b/logback-core/src/main/java/ch/qos/logback/core/joran/node/ComponentNode.java
new file mode 100644
index 0000000000000000000000000000000000000000..3e6f6ceee6a2e0aadfcd3183519d92b5fe8741ba
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/node/ComponentNode.java
@@ -0,0 +1,8 @@
+package ch.qos.logback.core.joran.node;
+
+
+public class ComponentNode {
+
+ String classStr;
+
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ActionException.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ActionException.java
index b6d68f06c4299eae2ad6db529880dc3929fec83d..d210178da324515fe11573b697f6b7a950a6aaa6 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ActionException.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ActionException.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConfigurationWatchList.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConfigurationWatchList.java
index 6e70d2211546312de5ed8924cd12d14b6e2fe3b9..0accacdeaa408f45af0d808c685b475d6b60097b 100755
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConfigurationWatchList.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConfigurationWatchList.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConsoleTarget.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConsoleTarget.java
index 1f07597ad6a65bdbda1a39fa64f1b1ab90986463..9a71e014a25af526b71f9e7289b45fe8abd3ad45 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConsoleTarget.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConsoleTarget.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/DefaultClass.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/DefaultClass.java
index c2059f5426199c2305fecf28f5b23a78b30600d8..725abe3ea605208a69ed852a4a8aeb6365fc2a20 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/DefaultClass.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/DefaultClass.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/DefaultNestedComponentRegistry.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/DefaultNestedComponentRegistry.java
index 307eab56d53cece720b8c70dd710878eb6f0a48d..a636a239ba75b96a53a1e0775a8bcfe05f5e7e02 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/DefaultNestedComponentRegistry.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/DefaultNestedComponentRegistry.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ElementPath.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ElementPath.java
new file mode 100644
index 0000000000000000000000000000000000000000..7e78b28d0a8d8c8911e1f4802f8acc5459eb2d91
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ElementPath.java
@@ -0,0 +1,122 @@
+package ch.qos.logback.core.joran.spi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A element path characterizes a traversal path in an XML document.
+ *
+ * @author Ceki Gulcu
+ * @since 1.1.0
+ */
+public class ElementPath {
+ // contains String instances
+ ArrayList partList = new ArrayList();
+
+ public ElementPath() {
+ }
+
+ public ElementPath(List list) {
+ partList.addAll(list);
+ }
+
+ /**
+ * Build an elementPath from a string.
+ *
+ * Note that "/x" is considered equivalent to "x" and to "x/"
+ */
+ public ElementPath(String pathStr) {
+ if (pathStr == null) {
+ return;
+ }
+
+ String[] partArray = pathStr.split("/");
+ if(partArray == null) return;
+
+ for(String part: partArray) {
+ if(part.length() >0) {
+ partList.add(part);
+ }
+ }
+ }
+
+ public ElementPath duplicate() {
+ ElementPath p = new ElementPath();
+ p.partList.addAll(this.partList);
+ return p;
+ }
+
+ // Joran error skipping relies on the equals method
+ @Override
+ public boolean equals(Object o) {
+ if ((o == null) || !(o instanceof ElementPath)) {
+ return false;
+ }
+
+ ElementPath r = (ElementPath) o;
+
+ if (r.size() != size()) {
+ return false;
+ }
+
+ int len = size();
+
+ for (int i = 0; i < len; i++) {
+ if (!equalityCheck(get(i), r.get(i))) {
+ return false;
+ }
+ }
+
+ // if everything matches, then the two patterns are equal
+ return true;
+ }
+
+ private boolean equalityCheck(String x, String y) {
+ return x.equalsIgnoreCase(y);
+ }
+
+ public List getCopyOfPartList() {
+ return new ArrayList(partList);
+ }
+
+ public void push(String s) {
+ partList.add(s);
+ }
+
+ public String get(int i) {
+ return (String) partList.get(i);
+ }
+
+ public void pop() {
+ if (!partList.isEmpty()) {
+ partList.remove(partList.size() - 1);
+ }
+ }
+
+ public String peekLast() {
+ if (!partList.isEmpty()) {
+ int size = partList.size();
+ return (String) partList.get(size - 1);
+ } else {
+ return null;
+ }
+ }
+
+ public int size() {
+ return partList.size();
+ }
+
+
+ protected String toStableString() {
+ StringBuilder result = new StringBuilder();
+ for (String current : partList) {
+ result.append("[").append(current).append("]");
+ }
+ return result.toString();
+ }
+
+ @Override
+ public String toString() {
+ return toStableString();
+ }
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ElementSelector.java
similarity index 53%
rename from logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java
rename to logback-core/src/main/java/ch/qos/logback/core/joran/spi/ElementSelector.java
index cb950483fd73974eef24690dc6cead841f8904fd..0be04e2fd9c6348e460e99dad09d1939552c72b6 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ElementSelector.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -17,101 +17,47 @@ import java.util.ArrayList;
import java.util.List;
/**
- * A pattern is used to designate XML elements in a document.
- *
- *
For more information see
- * http://logback.qos.ch/manual/onJoran.html#pattern
- *
+ * ElementSelector extends {@link ElementPath} with matching operations such as {@link #fullPathMatch(ElementPath)},
+ * {@link #getPrefixMatchLength(ElementPath)} and {@link #getTailMatchLength(ElementPath)}.
+ *
+ *
Parts of the path may contain '*' for wildcard matching.
+ *
* @author Ceki Gülcü
+ * @since 1.1.0
*/
-public class Pattern {
-
- // contains String instances
- ArrayList partList = new ArrayList();
+public class ElementSelector extends ElementPath {
-
- public Pattern() {
+ public ElementSelector() {
+ super();
}
- public Pattern(List list) {
- partList.addAll(list);
+ public ElementSelector(List list) {
+ super(list);
}
/**
- * Build a pattern from a string.
- *
+ * Build an elementPath from a string.
+ *
* Note that "/x" is considered equivalent to "x" and to "x/"
- *
+ *
*/
- public Pattern(String p) {
- this();
-
- if (p == null) {
- return;
- }
-
- int lastIndex = 0;
-
- // System.out.println("p is "+ p);
- while (true) {
- int k = p.indexOf('/', lastIndex);
-
- // System.out.println("k is "+ k);
- if (k == -1) {
- String lastPart = p.substring(lastIndex);
- if (lastPart != null && lastPart.length() > 0) {
- partList.add(p.substring(lastIndex));
- }
- break;
- } else {
- String c = p.substring(lastIndex, k);
-
- if (c.length() > 0) {
- partList.add(c);
- }
-
- lastIndex = k + 1;
- }
- }
-
- // System.out.println(components);
+ public ElementSelector(String p) {
+ super(p);
}
- public List getCopyOfPartList() {
- return new ArrayList(partList);
- }
-
- public Object clone() {
- Pattern p = new Pattern();
- p.partList.addAll(this.partList);
- return p;
- }
-
- public void push(String s) {
- partList.add(s);
- }
-
- public int size() {
- return partList.size();
- }
-
- public String get(int i) {
- return (String) partList.get(i);
- }
-
- public void pop() {
- if (!partList.isEmpty()) {
- partList.remove(partList.size() - 1);
+ public boolean fullPathMatch(ElementPath path) {
+ if (path.size() != size()) {
+ return false;
}
- }
- public String peekLast() {
- if (!partList.isEmpty()) {
- int size = partList.size();
- return (String) partList.get(size - 1);
- } else {
- return null;
+ int len = size();
+ for (int i = 0; i < len; i++) {
+ if (!equalityCheck(get(i), path.get(i))) {
+ return false;
+ }
}
+ // if everything matches, then the two patterns are equal
+ return true;
}
/**
@@ -119,7 +65,7 @@ public class Pattern {
* with the pattern p passed as parameter. By "tail" components we mean the
* components at the end of the pattern.
*/
- public int getTailMatchLength(Pattern p) {
+ public int getTailMatchLength(ElementPath p) {
if (p == null) {
return 0;
}
@@ -137,8 +83,8 @@ public class Pattern {
// loop from the end to the front
for (int i = 1; i <= minLen; i++) {
- String l = (String) this.partList.get(lSize - i);
- String r = (String) p.partList.get(rSize - i);
+ String l = this.partList.get(lSize - i);
+ String r = p.partList.get(rSize - i);
if (equalityCheck(l, r)) {
match++;
@@ -149,21 +95,20 @@ public class Pattern {
return match;
}
- public boolean isContained(Pattern p) {
+ public boolean isContainedIn(ElementPath p) {
if(p == null) {
return false;
}
- String lStr = this.toString();
- return lStr.contains(p.toString());
+ return p.toStableString().contains(toStableString());
}
-
-
+
+
/**
* Returns the number of "prefix" components that this pattern has in common
* with the pattern p passed as parameter. By "prefix" components we mean the
* components at the beginning of the pattern.
*/
- public int getPrefixMatchLength(Pattern p) {
+ public int getPrefixMatchLength(ElementPath p) {
if (p == null) {
return 0;
}
@@ -180,8 +125,8 @@ public class Pattern {
int match = 0;
for (int i = 0; i < minLen; i++) {
- String l = (String) this.partList.get(i);
- String r = (String) p.partList.get(i);
+ String l = this.partList.get(i);
+ String r = p.partList.get(i);
if (equalityCheck(l, r)) {
match++;
@@ -199,11 +144,11 @@ public class Pattern {
@Override
public boolean equals(Object o) {
- if ((o == null) || !(o instanceof Pattern)) {
+ if ((o == null) || !(o instanceof ElementSelector)) {
return false;
}
- Pattern r = (Pattern) o;
+ ElementSelector r = (ElementSelector) o;
if (r.size() != size()) {
return false;
@@ -231,16 +176,8 @@ public class Pattern {
// http://jira.qos.ch/browse/LBCORE-76
hc ^= get(i).toLowerCase().hashCode();
}
-
return hc;
}
- @Override
- public String toString() {
- StringBuilder result = new StringBuilder();
- for (String current : partList) {
- result.append("[").append(current).append("]");
- }
- return result.toString();
- }
+
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/EventPlayer.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/EventPlayer.java
index aa52afbe310a25065063fc622d30675affed487b..bf6df3c994e4f34b8085d99e91793859a0308646 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/EventPlayer.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/EventPlayer.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/HostClassAndPropertyDouble.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/HostClassAndPropertyDouble.java
index 56832feeacda5ccd58e15de110b0e8726fc51a43..8eddce0942992814e50b833559989c9a4fa487d7 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/HostClassAndPropertyDouble.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/HostClassAndPropertyDouble.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/InterpretationContext.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/InterpretationContext.java
index 20a3cca707a9a64b51dc41d694b4d029ba81c581..2c0292b5ffd37ce73013906a1a5cd3d1851605e8 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/InterpretationContext.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/InterpretationContext.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -15,7 +15,6 @@ package ch.qos.logback.core.joran.spi;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -62,6 +61,10 @@ public class InterpretationContext extends ContextAwareBase implements
return defaultNestedComponentRegistry;
}
+ public Map getCopyOfPropertyMap() {
+ return new HashMap(propertiesMap);
+ }
+
void setPropertiesMap(Map propertiesMap) {
this.propertiesMap = propertiesMap;
}
@@ -129,10 +132,10 @@ public class InterpretationContext extends ContextAwareBase implements
if (props == null) {
return;
}
- Iterator i = props.keySet().iterator();
- while (i.hasNext()) {
- String key = (String) i.next();
- addSubstitutionProperty(key, props.getProperty(key));
+ for(Object keyObject: props.keySet()) {
+ String key = (String) keyObject;
+ String val = props.getProperty(key);
+ addSubstitutionProperty(key, val);
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java
index 53a430c247e4c672a3728b700cc1873b5d43d392..50645559db849f9da9ac94be4f764b18c7591ae0 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -71,7 +71,7 @@ public class Interpreter {
final private InterpretationContext interpretationContext;
final private ArrayList implicitActions;
final private CAI_WithLocatorSupport cai;
- private Pattern pattern;
+ private ElementPath elementPath;
Locator locator;
EventPlayer eventPlayer;
@@ -89,15 +89,14 @@ public class Interpreter {
* If the skip nested is set, then we skip all its nested elements until it is
* set back to null at when the element's end is reached.
*/
- Pattern skip = null;
+ ElementPath skip = null;
- public Interpreter(Context context, RuleStore rs, Pattern initialPattern) {
- this.cai = new CAI_WithLocatorSupport(this);
- this.cai.setContext(context);
+ public Interpreter(Context context, RuleStore rs, ElementPath initialElementPath) {
+ this.cai = new CAI_WithLocatorSupport(context, this);
ruleStore = rs;
interpretationContext = new InterpretationContext(context, this);
implicitActions = new ArrayList(3);
- this.pattern = initialPattern;
+ this.elementPath = initialElementPath;
actionListStack = new Stack>();
eventPlayer = new EventPlayer(this);
}
@@ -134,7 +133,7 @@ public class Interpreter {
String qName, Attributes atts) {
String tagName = getTagName(localName, qName);
- pattern.push(tagName);
+ elementPath.push(tagName);
if (skip != null) {
// every startElement pushes an action list
@@ -142,7 +141,7 @@ public class Interpreter {
return;
}
- List applicableActionList = getApplicableActionList(pattern, atts);
+ List applicableActionList = getApplicableActionList(elementPath, atts);
if (applicableActionList != null) {
actionListStack.add(applicableActionList);
callBeginAction(applicableActionList, tagName, atts);
@@ -150,7 +149,7 @@ public class Interpreter {
// every startElement pushes an action list
pushEmptyActionList();
String errMsg = "no applicable action for [" + tagName
- + "], current pattern is [" + pattern + "]";
+ + "], current ElementPath is [" + elementPath + "]";
cai.addError(errMsg);
}
}
@@ -190,7 +189,7 @@ public class Interpreter {
List applicableActionList = (List) actionListStack.pop();
if (skip != null) {
- if (skip.equals(pattern)) {
+ if (skip.equals(elementPath)) {
skip = null;
}
} else if (applicableActionList != EMPTY_LIST) {
@@ -198,7 +197,7 @@ public class Interpreter {
}
// given that we always push, we must also pop the pattern
- pattern.pop();
+ elementPath.pop();
}
public Locator getLocator() {
@@ -228,14 +227,14 @@ public class Interpreter {
* action is found, it is returned. Thus, the returned list will have at most
* one element.
*/
- List lookupImplicitAction(Pattern pattern, Attributes attributes,
+ List lookupImplicitAction(ElementPath elementPath, Attributes attributes,
InterpretationContext ec) {
int len = implicitActions.size();
for (int i = 0; i < len; i++) {
ImplicitAction ia = (ImplicitAction) implicitActions.get(i);
- if (ia.isApplicable(pattern, attributes, ec)) {
+ if (ia.isApplicable(elementPath, attributes, ec)) {
List actionList = new ArrayList(1);
actionList.add(ia);
@@ -249,12 +248,12 @@ public class Interpreter {
/**
* Return the list of applicable patterns for this
*/
- List getApplicableActionList(Pattern pattern, Attributes attributes) {
- List applicableActionList = ruleStore.matchActions(pattern);
+ List getApplicableActionList(ElementPath elementPath, Attributes attributes) {
+ List applicableActionList = ruleStore.matchActions(elementPath);
// logger.debug("set of applicable patterns: " + applicableActionList);
if (applicableActionList == null) {
- applicableActionList = lookupImplicitAction(pattern, attributes,
+ applicableActionList = lookupImplicitAction(elementPath, attributes,
interpretationContext);
}
@@ -275,10 +274,10 @@ public class Interpreter {
try {
action.begin(interpretationContext, tagName, atts);
} catch (ActionException e) {
- skip = (Pattern) pattern.clone();
+ skip = elementPath.duplicate();
cai.addError("ActionException in Action for tag [" + tagName + "]", e);
} catch (RuntimeException e) {
- skip = (Pattern) pattern.clone();
+ skip = elementPath.duplicate();
cai.addError("RuntimeException in Action for tag [" + tagName + "]", e);
}
}
@@ -291,7 +290,7 @@ public class Interpreter {
Iterator i = applicableActionList.iterator();
while (i.hasNext()) {
- Action action = (Action) i.next();
+ Action action = i.next();
try {
action.body(interpretationContext, body);
} catch (ActionException ae) {
@@ -311,7 +310,7 @@ public class Interpreter {
Iterator i = applicableActionList.iterator();
while (i.hasNext()) {
- Action action = (Action) i.next();
+ Action action = i.next();
// now let us invoke the end method of the action. We catch and report
// any eventual exceptions
try {
@@ -341,8 +340,8 @@ public class Interpreter {
*/
class CAI_WithLocatorSupport extends ContextAwareImpl {
- CAI_WithLocatorSupport(Interpreter interpreter) {
- super(interpreter);
+ CAI_WithLocatorSupport(Context context, Interpreter interpreter) {
+ super(context, interpreter);
}
@Override
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/JoranException.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/JoranException.java
index eb0a6af7edc32b49b0ba2647cb540457f0177c15..b75a94e3b2896beb49b50137b192103dade25e2f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/JoranException.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/JoranException.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/NoAutoStart.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/NoAutoStart.java
index 06e4b39e0cd9a75b34439d35108f86187d2e4563..c4662b60452ec7b7ea1831426a7180558381a71e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/NoAutoStart.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/NoAutoStart.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/NoAutoStartUtil.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/NoAutoStartUtil.java
index aef34579c5b11aa6608c4cd92b337d3811a5da82..89100c9f5cc6793083e8c2cd8b3c995047b4dc6f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/NoAutoStartUtil.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/NoAutoStartUtil.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/RuleStore.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/RuleStore.java
index d94ac0031e10fb179820d1bfe47e81eb0252474b..32f9626988752753dad5b87d29b3cf753513c654 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/RuleStore.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/RuleStore.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -19,21 +19,41 @@ import ch.qos.logback.core.joran.action.Action;
/**
*
- * As its name indicates, a RuleStore contains 2-tuples consists of a Pattern
+ * As its name indicates, a RuleStore contains 2-tuples consists of a ElementSelector
* and an Action.
*
*
As a joran configurator goes through the elements in a document, it asks
* the rule store whether there are rules matching the current pattern by
- * invoking the {@link #matchActions(Pattern)} method.
+ * invoking the {@link #matchActions(ElementPath)} method.
*
* @author Ceki Gülcü
*
*/
public interface RuleStore {
- void addRule(Pattern pattern, String actionClassStr)
+
+ /**
+ * Add a new rule, given by a pattern and a action class (String).
+ *
+ * @param elementSelector
+ * @param actionClassStr
+ * @throws ClassNotFoundException
+ */
+ void addRule(ElementSelector elementSelector, String actionClassStr)
throws ClassNotFoundException;
- void addRule(Pattern pattern, Action action);
+ /**
+ * Add a new rule, given by a pattern and an action instance.
+ *
+ * @param elementSelector
+ * @param action
+ */
+ void addRule(ElementSelector elementSelector, Action action);
- List matchActions(Pattern currentPatern);
+ /**
+ * Return a list of actions matching a pattern.
+ *
+ * @param elementPath the path to match for
+ * @return list of matching actions
+ */
+ List matchActions(ElementPath elementPath);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/SimpleRuleStore.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/SimpleRuleStore.java
old mode 100644
new mode 100755
index ea6c16b798a30402206b55c08abb1d8edcf38eaa..3efede2bf13ce79595bd42da990fa7c42f2575e8
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/SimpleRuleStore.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/SimpleRuleStore.java
@@ -1,6 +1,6 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ * Copyright (C) 1999-2013, 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
@@ -31,10 +31,10 @@ import ch.qos.logback.core.util.OptionHelper;
*/
public class SimpleRuleStore extends ContextAwareBase implements RuleStore {
- static String ANY = "*";
+ static String KLEENE_STAR = "*";
// key: Pattern instance, value: ArrayList containing actions
- HashMap> rules = new HashMap>();
+ HashMap> rules = new HashMap>();
// public SimpleRuleStore() {
// }
@@ -47,20 +47,20 @@ public class SimpleRuleStore extends ContextAwareBase implements RuleStore {
* Add a new rule, i.e. a pattern, action pair to the rule store.