To use logback-access with Tomcat, after downloading the
logback distribution, place the files
- logback-core-1.1.9.jar and
- logback-access-1.1.9.jar under
+ logback-core-1.2.3.jar and
+ logback-access-1.2.3.jar under
$TOMCAT_HOME/lib/ directory, where $TOMCAT_HOME is the folder
where you have installed Tomcat.
diff -Nru logback-1.1.9/docs/css/maven-base.css logback-1.2.3/docs/css/maven-base.css
--- logback-1.1.9/docs/css/maven-base.css 2017-01-20 18:53:03.000000000 +0000
+++ logback-1.2.3/docs/css/maven-base.css 2017-04-01 03:21:16.000000000 +0000
@@ -1,155 +1,174 @@
-body {
- margin: 0px;
- padding: 0px;
-}
-img {
- border:none;
-}
-table {
- padding:0px;
- width: 100%;
- margin-left: -2px;
- margin-right: -2px;
-}
-acronym {
- cursor: help;
- border-bottom: 1px dotted #feb;
-}
-table.bodyTable th, table.bodyTable td {
- padding: 2px 4px 2px 4px;
- vertical-align: top;
-}
-div.clear{
- clear:both;
- visibility: hidden;
-}
-div.clear hr{
- display: none;
-}
-#bannerLeft, #bannerRight {
- font-size: xx-large;
- font-weight: bold;
-}
-#bannerLeft img, #bannerRight img {
- margin: 0px;
-}
-.xleft, #bannerLeft img {
- float:left;
-}
-.xright, #bannerRight {
- float:right;
-}
-#banner {
- padding: 0px;
-}
-#banner img {
- border: none;
-}
-#breadcrumbs {
- padding: 3px 10px 3px 10px;
-}
-#leftColumn {
- width: 170px;
- float:left;
- overflow: auto;
-}
-#bodyColumn {
- margin-right: 1.5em;
- margin-left: 197px;
-}
-#legend {
- padding: 8px 0 8px 0;
-}
-#navcolumn {
- padding: 8px 4px 0 8px;
-}
-#navcolumn h5 {
- margin: 0;
- padding: 0;
- font-size: small;
-}
-#navcolumn ul {
- margin: 0;
- padding: 0;
- font-size: small;
-}
-#navcolumn li {
- list-style-type: none;
- background-image: none;
- background-repeat: no-repeat;
- background-position: 0 0.4em;
- padding-left: 16px;
- list-style-position: outside;
- line-height: 1.2em;
- font-size: smaller;
-}
-#navcolumn li.expanded {
- background-image: url(../images/expanded.gif);
-}
-#navcolumn li.collapsed {
- background-image: url(../images/collapsed.gif);
-}
-#navcolumn li.none {
- text-indent: -1em;
- margin-left: 1em;
-}
-#poweredBy {
- text-align: center;
-}
-#navcolumn img {
- margin-top: 10px;
- margin-bottom: 3px;
-}
-#poweredBy img {
- display:block;
- margin: 20px 0 20px 17px;
-}
-#search img {
- margin: 0px;
- display: block;
-}
-#search #q, #search #btnG {
- border: 1px solid #999;
- margin-bottom:10px;
-}
-#search form {
- margin: 0px;
-}
-#lastPublished {
- font-size: x-small;
-}
-.navSection {
- margin-bottom: 2px;
- padding: 8px;
-}
-.navSectionHead {
- font-weight: bold;
- font-size: x-small;
-}
-.section {
- padding: 4px;
-}
-#footer {
- padding: 3px 10px 3px 10px;
- font-size: x-small;
-}
-#breadcrumbs {
- font-size: x-small;
- margin: 0pt;
-}
-.source {
- padding: 12px;
- margin: 1em 7px 1em 7px;
-}
-.source pre {
- margin: 0px;
- padding: 0px;
-}
-#navcolumn img.imageLink, .imageLink {
- padding-left: 0px;
- padding-bottom: 0px;
- padding-top: 0px;
- padding-right: 2px;
- border: 0px;
- margin: 0px;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+body {
+ margin: 0px;
+ padding: 0px;
+}
+img {
+ border:none;
+}
+table {
+ padding:0px;
+ width: 100%;
+ margin-left: -2px;
+ margin-right: -2px;
+}
+acronym {
+ cursor: help;
+ border-bottom: 1px dotted #feb;
+}
+table.bodyTable th, table.bodyTable td {
+ padding: 2px 4px 2px 4px;
+ vertical-align: top;
+}
+div.clear{
+ clear:both;
+ visibility: hidden;
+}
+div.clear hr{
+ display: none;
+}
+#bannerLeft, #bannerRight {
+ font-size: xx-large;
+ font-weight: bold;
+}
+#bannerLeft img, #bannerRight img {
+ margin: 0px;
+}
+.xleft, #bannerLeft img {
+ float:left;
+}
+.xright, #bannerRight {
+ float:right;
+}
+#banner {
+ padding: 0px;
+}
+#banner img {
+ border: none;
+}
+#breadcrumbs {
+ padding: 3px 10px 3px 10px;
+}
+#leftColumn {
+ width: 170px;
+ float:left;
+ overflow: auto;
+}
+#bodyColumn {
+ margin-right: 1.5em;
+ margin-left: 197px;
+}
+#legend {
+ padding: 8px 0 8px 0;
+}
+#navcolumn {
+ padding: 8px 4px 0 8px;
+}
+#navcolumn h5 {
+ margin: 0;
+ padding: 0;
+ font-size: small;
+}
+#navcolumn ul {
+ margin: 0;
+ padding: 0;
+ font-size: small;
+}
+#navcolumn li {
+ list-style-type: none;
+ background-image: none;
+ background-repeat: no-repeat;
+ background-position: 0 0.4em;
+ padding-left: 16px;
+ list-style-position: outside;
+ line-height: 1.2em;
+ font-size: smaller;
+}
+#navcolumn li.expanded {
+ background-image: url(../images/expanded.gif);
+}
+#navcolumn li.collapsed {
+ background-image: url(../images/collapsed.gif);
+}
+#navcolumn li.none {
+ text-indent: -1em;
+ margin-left: 1em;
+}
+#poweredBy {
+ text-align: center;
+}
+#navcolumn img {
+ margin-top: 10px;
+ margin-bottom: 3px;
+}
+#poweredBy img {
+ display:block;
+ margin: 20px 0 20px 17px;
+}
+#search img {
+ margin: 0px;
+ display: block;
+}
+#search #q, #search #btnG {
+ border: 1px solid #999;
+ margin-bottom:10px;
+}
+#search form {
+ margin: 0px;
+}
+#lastPublished {
+ font-size: x-small;
+}
+.navSection {
+ margin-bottom: 2px;
+ padding: 8px;
+}
+.navSectionHead {
+ font-weight: bold;
+ font-size: x-small;
+}
+.section {
+ padding: 4px;
+}
+#footer {
+ padding: 3px 10px 3px 10px;
+ font-size: x-small;
+}
+#breadcrumbs {
+ font-size: x-small;
+ margin: 0pt;
+}
+.source {
+ padding: 12px;
+ margin: 1em 7px 1em 7px;
+}
+.source pre {
+ margin: 0px;
+ padding: 0px;
+}
+#navcolumn img.imageLink, .imageLink {
+ padding-left: 0px;
+ padding-bottom: 0px;
+ padding-top: 0px;
+ padding-right: 2px;
+ border: 0px;
+ margin: 0px;
+}
diff -Nru logback-1.1.9/docs/css/maven-theme.css logback-1.2.3/docs/css/maven-theme.css
--- logback-1.1.9/docs/css/maven-theme.css 2017-01-20 18:53:03.000000000 +0000
+++ logback-1.2.3/docs/css/maven-theme.css 2017-04-01 03:21:16.000000000 +0000
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
body {
padding: 0px 0px 10px 0px;
}
@@ -64,7 +83,7 @@
h5 {
padding: 4px 4px 4px 6px;
color: #900;
- font-size: normal;
+ font-size: medium;
}
p {
line-height: 1.3em;
@@ -79,6 +98,7 @@
margin: 10px 0 0 5px;
border: 1px solid #999;
background-color: #eee;
+ padding-bottom: 3px; /* IE-9 scrollbar-fix */
}
#navcolumn h5 {
font-size: smaller;
diff -Nru logback-1.1.9/docs/css/print.css logback-1.2.3/docs/css/print.css
--- logback-1.1.9/docs/css/print.css 2017-01-20 18:53:03.000000000 +0000
+++ logback-1.2.3/docs/css/print.css 2017-04-01 03:21:16.000000000 +0000
@@ -1,7 +1,26 @@
-#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn {
- display: none !important;
-}
-#bodyColumn, body.docs div.docs {
- margin: 0 !important;
- border: none !important
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn {
+ display: none !important;
+}
+#bodyColumn, body.docs div.docs {
+ margin: 0 !important;
+ border: none !important
+}
diff -Nru logback-1.1.9/docs/dependencies.html logback-1.2.3/docs/dependencies.html
--- logback-1.1.9/docs/dependencies.html 2017-01-20 18:53:48.000000000 +0000
+++ logback-1.2.3/docs/dependencies.html 2017-04-01 04:26:02.000000000 +0000
@@ -48,7 +48,7 @@
Logback jar files must be present on Jetty's class
path. These files are
- logback-core-1.1.9.jar and
- logback-classic-1.1.9.jar. These files
+ logback-core-1.2.3.jar and
+ logback-classic-1.2.3.jar. These files
should be placed under the $JETTY_HOME/lib
directory.
@@ -326,7 +326,7 @@
Since Jetty uses an older version of SLF4J internally,
we recommend that the old version be replaced by
- slf4j-api-1.7.22.jar. This file can be
+ slf4j-api-1.7.25.jar. This file can be
downloaded from the SLF4J project.
Binary files /tmp/tmp_w3zLB/z9ana35gcZ/logback-1.1.9/docs/images/setup/deselectMavenDependenciesExport.png and /tmp/tmp_w3zLB/lmaIvID0_A/logback-1.2.3/docs/images/setup/deselectMavenDependenciesExport.png differ
Binary files /tmp/tmp_w3zLB/z9ana35gcZ/logback-1.1.9/docs/images/setup/discoverM2EConnectors.png and /tmp/tmp_w3zLB/lmaIvID0_A/logback-1.2.3/docs/images/setup/discoverM2EConnectors.png differ
Binary files /tmp/tmp_w3zLB/z9ana35gcZ/logback-1.1.9/docs/images/setup/removeGroovyExclusions.png and /tmp/tmp_w3zLB/lmaIvID0_A/logback-1.2.3/docs/images/setup/removeGroovyExclusions.png differ
diff -Nru logback-1.1.9/docs/js/dsl.js logback-1.2.3/docs/js/dsl.js
--- logback-1.1.9/docs/js/dsl.js 2017-01-20 18:53:48.000000000 +0000
+++ logback-1.2.3/docs/js/dsl.js 2017-04-01 03:20:39.000000000 +0000
@@ -1,5 +1,5 @@
-var asGroovyURL='http://logback.qos.ch/translator/dsl/asGroovy';
+var asGroovyURL='https://logback.qos.ch/translator/dsl/asGroovy';
function asGroovy(id) {
diff -Nru logback-1.1.9/docs/manual/appenders.html logback-1.2.3/docs/manual/appenders.html
--- logback-1.1.9/docs/manual/appenders.html 2017-01-20 18:53:48.000000000 +0000
+++ logback-1.2.3/docs/manual/appenders.html 2017-04-01 04:26:02.000000000 +0000
@@ -272,7 +272,24 @@
underlying OutputStreamAppender. Encoders are
described in a dedicated chapter.
-
+
+
+
immediateFlush
+
boolean
+
+
The default value for immediateFlush is 'true'. Immediate
+ flushing of the output stream ensures that logging events are
+ immediately written out and will not be lost in case your
+ application exits without properly closing appenders. On the
+ other hand, setting this property to 'false' is likely to
+ quadruple (your mileage may vary) logging throughput. Again, if
+ immediateFlush is set to 'false' and
+ if appenders are not closed properly when your application exits,
+ then logging events not yet written to disk may be lost.
+
+
+
@@ -435,7 +452,6 @@
-
prudent
@@ -509,11 +525,8 @@
events are not lost in case your application exits without properly
closing appenders. However, for significantly increased logging
throughput, you may want to set the immediateFlush property of the underlying
- Encoder to false . Encoders and in
- particular LayoutWrappingEncoder
- are described in a separate chapter.
+ class="prop">immediateFlush property to
+ false.
Below is an example of a configuration file for
FileAppender:
@@ -528,6 +541,8 @@
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>testFile.log</file>
<append>true</append>
+ <!-- set immediateFlush to false for much higher logging throughput -->
+ <immediateFlush>true</immediateFlush>
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
@@ -4532,8 +4547,8 @@
<defaultValue>NA</defaultValue>
</Discriminator>
<sift>
- <appender name="ch.qos.logback:logback-site:jar:1.1.9" class="ch.qos.logback.core.FileAppender">
- <file>byUser/ch.qos.logback:logback-site:jar:1.1.9.log</file>
+ <appender name="ch.qos.logback:logback-site:jar:1.2.3" class="ch.qos.logback.core.FileAppender">
+ <file>byUser/ch.qos.logback:logback-site:jar:1.2.3.log</file>
<layout class="ch.qos.logback.access.PatternLayout">
<pattern>%h %l %u %t \"%r\" %s %b</pattern>
</layout>
diff -Nru logback-1.1.9/docs/manual/configuration.html logback-1.2.3/docs/manual/configuration.html
--- logback-1.1.9/docs/manual/configuration.html 2017-01-20 18:53:48.000000000 +0000
+++ logback-1.2.3/docs/manual/configuration.html 2017-04-01 04:26:02.000000000 +0000
@@ -81,20 +81,21 @@
In order to release the resources used by logback-classic, it is
always a good idea to stop the logback context. Stopping the
@@ -800,7 +801,9 @@
the contextDestroyed
method of ServletContextListener in order to stop
- logback-classic and release resources.
+ logback-classic and release resources. Starting with version
+ 1.1.10, the appropriate ServletContextListener is
+ installed automatically for you (see just below).
Stopping logback-classic
@@ -823,8 +826,48 @@
can delay shutdown by a user specified duration. Note that you may
install a shutdown hook of your own making by setting the class attribute to correspond to your shutdown
- hook's class name..
+ hook's class name.
+
+
Stopping logback-classic
+ in web-applications
+
+
since 1.1.10 Logback-classic will
+ automatically ask the web-server to install a LogbackServletContainerInitializer
+ implementing the ServletContainerInitializer interface
+ (available in servlet-api 3.x and later). This initializer will in
+ turn install and instance of LogbackServletContextListener.
+ This listener will stop the current logback-classic context when
+ the web-app is stopped or reloaded.
+
+
+
You may disable the automatic the installation of
+ LogbackServletContextListener by setting a
+ <context-param> named
+ logbackDisableServletContainerInitializer in your
+ web-application's web.xml file. Here is the relevant snippet.
Note that
+ logbackDisableServletContainerInitializer variable
+ can also be set as a Java system property an OS environment
+ variable. The most local setting has priority, i.e. web-app first,
+ system property second and OS environment last.
+
+
+
+
+
Configuration file syntax
As you have seen thus far in the manual with plenty of examples
@@ -1470,7 +1513,12 @@
As they often come in handy, the HOSTNAME and CONTEXT_NAME
- variables are automatically defined and have context scope.
+ variables are automatically defined and have context scope. Given
+ that in some environments it may take some time to compute the
+ hostname, its value is computed lazily (only when needed). Moreover,
+ HOSTNAME can be set from within the configuration directly.
+
The doEncode() method starts by having the wrapped
layout convert the incoming event into string. The resulting text
string is converted to bytes according to the charset encoding
- chosen by the user. Those bytes are then written to the
- OutputStream given by the owning appender. By
- default, the OutputStream is immediately flushed,
- unless the immediateFlush property is
- explicitly set to 'false'. Setting the immediateFlush property to false can
- significantly improve logging throughput. See
- PatternLayoutEncoder below for sample configuration..
-
+ chosen by the user.
PatternLayoutEncoder
@@ -194,36 +184,9 @@
immediateFlush property
-
As a sub-class of LayoutWrappingEncoder,
- PatternLayoutEncoder admits the immediateFlush property. The default value
- for immediateFlush is 'true'. Immediate
- flushing of the output stream ensures that logging events are
- immediately written to disk and will not be lost in case your
- application exits without properly closing appenders. On the
- other hand, setting this property to 'false' is likely to
- quintuple (your mileage may vary) logging throughput. As
- mentioned previously, if immediateFlush
- is set to 'false' and if appenders are not closed properly when
- your application exits, then logging events not yet written to
- disk may be lost.
-
-
-
Below is a sample configuration for a
- FileAppender containing a
- PatternLayoutEncoder with its immediateFlush property set to 'false'.
The logback-*.jar files are part of the logback
- distribution whereas slf4j-api-1.7.22.jar ships
+ distribution whereas slf4j-api-1.7.25.jar ships
with SLF4J, a separate project.
diff -Nru logback-1.1.9/docs/manual/layouts.html logback-1.2.3/docs/manual/layouts.html
--- logback-1.1.9/docs/manual/layouts.html 2017-01-20 18:53:49.000000000 +0000
+++ logback-1.2.3/docs/manual/layouts.html 2017-04-01 04:26:02.000000000 +0000
@@ -819,7 +819,8 @@
full stack trace will be output.
-
The throwable conversion word can followed by one of
+
+
The throwable conversion word can followed by one of
the following options:
@@ -870,6 +871,17 @@
negative answer. Evaluators are described further
down in this document.
+
+
If you do not specify %throwable or another
+ throwable-related conversion word in the conversion pattern,
+ PatternLayout will automatically add it as the
+ last conversion word, on account of the importance of stack
+ trace information. The $nopex conversion word can be
+ substituted for %throwable, if you do not wish stack trace
+ information to be displayed. See also the %nopex conversion
+ word.
+
+
@@ -888,16 +900,6 @@
Same as the %throwable conversion word above with the
addition of class packaging information.
-
If you do not specify %xThrowable or another
- throwable-related conversion word in the conversion pattern,
- PatternLayout will automatically add it as the
- last conversion word, on account of the importance of stack
- trace information. The $nopex conversion word can be
- substituted for %xThrowable, if you do not wish stack
- trace information to be displayed. See also the %nopex
- conversion word.
-
-
At the end of each stack frame of the exception, a string
consisting of the jar file containing the relevant class
followed by the "Implementation-Version" as found in that
@@ -934,15 +936,18 @@
by a tilde, it is possible that the correct packaging data is
in reality [wombat.jar:1.7].
-
+
+
Please note that given its potential cost, computation of
+ packaging data
+ is disabled by default. When computation of
+ packaging data is enabled, PatternLayout will
+ automatically assume the %xThrowable suffix instead of
+ %throwable suffix at the end of the pattern string.
+
Feedback from
users indicates that Netbeans chokes on packaging
- information. If you are a Netbeans user, then you should
- disable packaging information in stack traces by adding
- "%ex" at the end of of your conversion pattern. For example,
- "%d %logger - %m%n" should be rewritten as "%d %logger -
- %m%n%ex"
+ information.
First, place the logback jars (that is
- logback-classic-1.1.9.jar,
- logback-core-1.1.9.jar and
- slf4j-api-1.7.22.jar) in Tomcat's global (shared) class
+ logback-classic-1.2.3.jar,
+ logback-core-1.2.3.jar and
+ slf4j-api-1.7.25.jar) in Tomcat's global (shared) class
folder. In Tomcat 6.x, this directory is
$TOMCAT_HOME/lib/.
diff -Nru logback-1.1.9/docs/manual/mdc.html logback-1.2.3/docs/manual/mdc.html
--- logback-1.1.9/docs/manual/mdc.html 2017-01-20 18:53:49.000000000 +0000
+++ logback-1.2.3/docs/manual/mdc.html 2017-04-01 04:26:02.000000000 +0000
@@ -89,18 +89,18 @@
lets the developer place information in a diagnostic
context that can be subsequently retrieved by certain logback
components. The MDC manages contextual information on
- a per thread basis. A child thread automatically
- inherits a copy of the mapped diagnostic context of its
- parent. Typically, while starting to service a new client request,
- the developer will insert pertinent contextual information, such
- as the client id, client's IP address, request parameters
- etc. into the MDC. Logback components, if
- appropriately configured, will automatically include this
- information in each log entry.
+ a per thread basis. Typically, while starting to service
+ a new client request, the developer will insert pertinent
+ contextual information, such as the client id, client's IP
+ address, request parameters etc. into the
+ MDC. Logback components, if appropriately configured,
+ will automatically include this information in each log entry.
Please note that MDC as implemented by logback-classic assumes
- that values are placed into the MDC with moderate frequency.
+ that values are placed into the MDC with moderate frequency. Also
+ note that a child thread does not automatically inherit a copy of
+ the mapped diagnostic context of its parent.
The next application named
diff -Nru logback-1.1.9/docs/manual/onJoran.html logback-1.2.3/docs/manual/onJoran.html
--- logback-1.1.9/docs/manual/onJoran.html 2017-01-20 18:53:49.000000000 +0000
+++ logback-1.2.3/docs/manual/onJoran.html 2017-04-01 04:26:02.000000000 +0000
@@ -67,7 +67,7 @@
To install Joran, simply download logback and add
- logback-core-1.1.9.jar to your
+ logback-core-1.2.3.jar to your
classpath.
Fix unintentional dependency on
+ OutputStreamAppender in
+ LayoutWrappingEncoder as reported in LOGBACK-1287.
+
+
+
Fix spurious System.out.println in AsyncAppender's
+ worker thread. This issue was reported in LOGBACK-1292 by
+ Nikolas Loutas with Thibault Meyer the relevant patch.
+
+
ConsoleAppender exception when run under Java WebStart. This
+ problem was reported in LOGBACK-1282 by
+ Clas Forsberg.
+
+
March 16th, 2017, Release of version 1.2.2
+
+
AsyncAppender no longer drops events when the
+ current thread has its interrupt flag set. This issue was reported
+ in LOGBACK-1247 by
+ Jakob Bergendahl who also provided the relevant pull request.
+
+
+
Removed JMSQueueAppender and
+ JMSTopicAppender. These appenders were undocumented
+ and had no apparent users.
+
+
Remove comment in logback-classic's
+ META-INF/services/javax.servlet.ServletContainerInitializer
+ file in order to keep Wildfly 8 happy. This issue was reported in
+ LOGBACK-1265
+ by Andy Wilkinson.
+
+
+
FileSize.toString() now reports files sizes in GB
+ in addition to sizes in MB and KB and Bytes. This fixes issue LOGBACK-1278.
+
+
+
+
March 1st, 2017, Release of version 1.1.11
+
+
Fix thread-safety issue with PatternLayoutBase
+ reported in LOGBACK-1270 by
+ Artem Bilan. Note that the fix was already present in the 1.2.x
+ series and was back-ported to the 1.1.x series.
+
+
+
+
February 9th, 2017, Release of version 1.2.1
+
+
To ensure backward compatibility of configuration files, the
+ immediateFlush property set for a
+ LayoutWrappingEncoder is propagated to the enclosing
+ OutputStreamAppender.
+
+
+
+
+
February 8th, 2017, Release of version 1.2.0
+
+
+
Encoder interface has changed and is no longer
+ expected to handle an OutputStream.
+
+
+
Encoder interface has changed and is no longer
+ expected to handle an OutputStream. This
+ simplification allows finer-grain locking resulting in significantly
+ improved performance.
+
+
+
Release 1.2.0 fixes a rather severe
+ serialization vulnerability in SocketServer and
+ ServerSocketReceiver. Users running these components
+ should upgrade immediately.
+
+
+
This release fixes a rather severe serialization vulnerability
+ in SocketServer and
+ ServerSocketReceiver. Users running these components
+ should upgrade immediately.
+
+
+
In TimeBasedRollingPolicy, fixed issue with totalSizeCap of more than 2^31. This problem
+ was reported in 1231 by Simon
+ Teng.
+
+
+
Logback-classic now searches for the file
+ logback-test.xml first, logback.groovy second
+ and logback.xml third. In previous versions
+ logback.groovy was looked up first which was non-sensical
+ in presense of logback-test.xml. This fixes LOGBACK-1245
+ reported by Joern Huxhorn.
+
+
+
+
+
+
February 5th, 2017, Release of version 1.1.10
+
+
Several changes to improve throughput (see spreadsheet)
+
+
+
+
The ReentrantLock in
+ OutputStreamAppender is now "unfair". In previous
+ versions of logback, a fair lock was used. Fair locks are much
+ slower. Just as importanly, logback has no mandate to influence
+ thread scheduling.
+
+
+
FileAppender now offers the bufferSize option. Previously, a
+ fixed-size 8K buffer was used. Increasing the bufferSize, for example to 256K,
+ significantly reduces thread-contention.
+
+
+
Critical parts of the code now use
+ COWArrayList, a custom developed allocation-free
+ lock-free thread-safe implementation of the {@link List}
+ interface. It is optimized for cases where iterations over the
+ list vastly outnumber modifications on the list. It is based on
+ CopyOnWriteArrayList but allows allocation-free
+ iterations over the list.
+
+
+
In PatternLayoutBase the same
+ StringBuilder is used over and over to reduce
+ memory allocation. This is safe as long as the owning appender
+ guarantees serial access to its layout. In the next version of
+ logback, i.e. 1.2.x, the read-write lock will no longer protect
+ access to the layout and there will be no guarantee of
+ serial access.
+
+
+
+
In web-applications, logback-classic will automatically
+ install a listener which will stop the logging context and
+ release resources when your web-app is reloaded. This enhancement
+ was requested LOGBACK-1170 by
+ Martin Wegner.
+
+
+
The AccessEvent.prepareForDeferredProcessing()
+ method was not idempotent. This caused subtle bugs under
+ Jetty. See LOGBACK-1189
+ for details. Many thanks to Per Olesen, Evan Meagher, Nick Babcock
+ and Mark Elliot for hunting down this bug.
+
+
+
As it may be time consuming in certain environments, the
+ HOSTNAME property is now computed lazily. This optimization
+ requested in LOGBACK-1221 by
+ Eugene Petrenko.
+
+
+
+
Joran now supports external XML entities. This feature was
+ requested in 1091 and the
+ relevant PR graciously provided by Jonas Neukomm.
+
+
+
+
+
January 20th, 2017, Release of version 1.1.9
Logback's internal executor service had a thread pool size of 2
which could be used up rather quickly, e.g. configuration scanning
diff -Nru logback-1.1.9/docs/project-reports.html logback-1.2.3/docs/project-reports.html
--- logback-1.1.9/docs/project-reports.html 2017-01-20 18:52:50.000000000 +0000
+++ logback-1.2.3/docs/project-reports.html 2017-04-01 04:25:53.000000000 +0000
@@ -1,5 +1,5 @@
-
+
The logback-*.jar files are part of the logback
- distribution whereas slf4j-api-1.7.22.jar ships
+ distribution whereas slf4j-api-1.7.25.jar ships
with SLF4J, a separate project.
<!-- The org.codehaus.janino:commons-compiler:2.7.8 dependency -->
+
<!-- The org.codehaus.janino:commons-compiler:3.0.6 dependency -->
<!-- will be automatically pulled in by Maven's transitivity rules -->
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
- <version>2.7.8</version>
+ <version>3.0.6</version>
</dependency>
@@ -257,7 +261,7 @@
Root directory. The import should finish successfully in a few
seconds.
-
Building with Eclipse
+
Building with Eclipse and "mvn eclipse:eclipse"
Building logback under Eclipse is a little trickier. Here are
instructions for building logback under Eclipse using the maven
@@ -276,13 +280,7 @@
-
Install Eclipse
-
-
-
-
Install the Groovy plugin for Eclipse.
+
Ensure that the Groovy plugin for Eclipse is installed.
@@ -297,9 +295,7 @@
In Eclipse, select Help → Intall new Software →
Work with the update site you chose in the previous step and
- then Select "Groovy-Eclipse Feature". Installation of other
- plugins in particular "m2e Configurator for Groovy-Eclipse"
- is not necessary
+ then Select "Groovy-Eclipse Feature".
@@ -318,30 +314,7 @@
In Eclipse, import the logback project: Import→
General→ Existing Projects into Workspace, select
$LOGBACK_HOME folder for the import
-
-
-
-
-
+
In Eclipse, clean all projects in Eclipse (Project →
Clean)
@@ -356,13 +329,90 @@
The above listed procedure has been last tested by the author
- using Eclipse Luna on February 25th, 2016.
+ using Eclipse Neon on March 17th, 2017.
+
+
Building with Eclipse+m2eclipse
+
+
Building with Eclipse and m2eclipse is a bit more complicated
+ due to the use of Groovy in logback-classic.
+
+
+
Here are the required steps:
+
+
+
+
Ensure that the Groovy plugin for Eclipse is installed. See
+ above for instructions.
+
+
In Eclipse, import the logback project: Import→
+ Maven→ Existing Maven Projects, select
+ $LOGBACK_HOME folder for the import
+
+
+
Install any discovered m2e connections,
+ e.g. "maven-bundle-plugin".
+
In Eclipse, select logback-classic project and check that it
+ has "Groovy" nature. If not add it by right clicking on
+ logback-classic project → Groovy → Convert Groovy to
+ Project.
+
+
+
At this stage Eclipse may complain about
+ GafferConfigurator not being resolved. To fix these
+ errors, select logback-classic project properties, select "Java
+ Build Path" → Source → "logback-classic/src/main/groovy".
+ Select "Excluded" and then click on Remove.
+
+
To fix the errors in the logback-examples project, you need
+ to instruct logback-classic to not export its Maven dependencies.
+ Select logback-classic project properties, select "Java
+ Build Path" → Order and Export and deselect "Maven Dependencies".
+
+
Call for volunteers Given that many
- users prefer M2Eclipse for building projects under Eclipse IDE, we
- are looking for volunteers to help work out the steps for building
- logback with M2Eclipse.
+
Call for volunteers Given that
+ many users prefer M2Eclipse for building projects under Eclipse
+ IDE, we are looking for volunteers to help simplify the steps
+ required for building logback with M2Eclipse.
- * For more information about this appender, please refer to:
- * http://logback.qos.ch/manual/appenders.html#JMSQueueAppender
- *
- * @author Ceki Gülcü
- */
-public class JMSQueueAppender extends JMSAppenderBase {
-
- static int SUCCESSIVE_FAILURE_LIMIT = 3;
-
- String queueBindingName;
- String qcfBindingName;
- QueueConnection queueConnection;
- QueueSession queueSession;
- QueueSender queueSender;
-
- int successiveFailureCount = 0;
-
- private PreSerializationTransformer pst = new LoggingEventPreSerializationTransformer();
-
- /**
- * The QueueConnectionFactoryBindingName option takes a string value.
- * Its value will be used to lookup the appropriate
- * QueueConnectionFactory from the JNDI context.
- */
- public void setQueueConnectionFactoryBindingName(String qcfBindingName) {
- this.qcfBindingName = qcfBindingName;
- }
-
- /**
- * Returns the value of the QueueConnectionFactoryBindingName option.
- */
- public String getQueueConnectionFactoryBindingName() {
- return qcfBindingName;
- }
-
- /**
- * The QueueBindingName option takes a string value. Its value will be
- * used to lookup the appropriate Queue from the JNDI context.
- */
- public void setQueueBindingName(String queueBindingName) {
- this.queueBindingName = queueBindingName;
- }
-
- /**
- * Returns the value of the QueueBindingName option.
- */
- public String getQueueBindingName() {
- return queueBindingName;
- }
-
- /**
- * Options are activated and become effective only after calling this method.
- */
- public void start() {
- QueueConnectionFactory queueConnectionFactory;
-
- try {
- Context jndi = buildJNDIContext();
-
- // addInfo("Looking up [" + qcfBindingName + "]");
- queueConnectionFactory = (QueueConnectionFactory) lookup(jndi, qcfBindingName);
- // addInfo("About to create QueueConnection.");
- if (userName != null) {
- this.queueConnection = queueConnectionFactory.createQueueConnection(userName, password);
- } else {
- this.queueConnection = queueConnectionFactory.createQueueConnection();
- }
-
- // addInfo(
- // "Creating QueueSession, non-transactional, "
- // + "in AUTO_ACKNOWLEDGE mode.");
- this.queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // addInfo("Looking up queue name [" + queueBindingName + "].");
- Queue queue = (Queue) lookup(jndi, queueBindingName);
-
- // addInfo("Creating QueueSender.");
- this.queueSender = queueSession.createSender(queue);
-
- // addInfo("Starting QueueConnection.");
- queueConnection.start();
-
- jndi.close();
- } catch (Exception e) {
- addError("Error while activating options for appender named [" + name + "].", e);
- }
-
- if (this.queueConnection != null && this.queueSession != null && this.queueSender != null) {
- super.start();
- }
- }
-
- /**
- * Close this JMSAppender. Closing releases all resources used by the
- * appender. A closed appender cannot be re-opened.
- */
- public synchronized void stop() {
- // The synchronized modifier avoids concurrent append and close operations
- if (!this.started) {
- return;
- }
-
- this.started = false;
-
- try {
- if (queueSession != null) {
- queueSession.close();
- }
- if (queueConnection != null) {
- queueConnection.close();
- }
- } catch (Exception e) {
- addError("Error while closing JMSAppender [" + name + "].", e);
- }
-
- // Help garbage collection
- queueSender = null;
- queueSession = null;
- queueConnection = null;
- }
-
- /**
- * This method called by {@link AppenderBase#doAppend} method to do most
- * of the real appending work.
- */
- public void append(ILoggingEvent event) {
- if (!isStarted()) {
- return;
- }
-
- try {
- ObjectMessage msg = queueSession.createObjectMessage();
- Serializable so = pst.transform(event);
- msg.setObject(so);
- queueSender.send(msg);
- successiveFailureCount = 0;
- } catch (Exception e) {
- successiveFailureCount++;
- if (successiveFailureCount > SUCCESSIVE_FAILURE_LIMIT) {
- stop();
- }
- addError("Could not send message in JMSQueueAppender [" + name + "].", e);
-
- }
- }
-
- /**
- * Returns the QueueConnection used for this appender. Only valid after
- * start() method has been invoked.
- */
- protected QueueConnection getQueueConnection() {
- return queueConnection;
- }
-
- /**
- * Returns the QueueSession used for this appender. Only valid after start()
- * method has been invoked.
- */
- protected QueueSession getQueueSession() {
- return queueSession;
- }
-
- /**
- * Returns the QueueSender used for this appender. Only valid after start()
- * method has been invoked.
- */
- protected QueueSender getQueueSender() {
- return queueSender;
- }
-}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueSink.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueSink.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueSink.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueSink.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,141 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.Properties;
-
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-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.classic.util.ContextInitializer;
-
-/**
- * A simple application that consumes logging events sent by a {@link
- * JMSQueueAppender}.
- *
- * @author Ceki Gülcü
- */
-public class JMSQueueSink implements javax.jms.MessageListener {
-
- private Logger logger = (Logger) LoggerFactory.getLogger(JMSTopicSink.class);
-
- static public void main(String[] args) throws Exception {
- if (args.length < 2) {
- usage("Wrong number of arguments.");
- }
-
- String qcfBindingName = args[0];
- String queueBindingName = args[1];
- String username = null;
- String password = null;
- if (args.length == 4) {
- username = args[2];
- password = args[3];
- }
-
- LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
- new ContextInitializer(loggerContext).autoConfig();
-
- new JMSQueueSink(qcfBindingName, queueBindingName, username, password);
-
- BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
- // Loop until the word "exit" is typed
- System.out.println("Type \"exit\" to quit JMSQueueSink.");
- while (true) {
- String s = stdin.readLine();
- if (s.equalsIgnoreCase("exit")) {
- System.out.println("Exiting. Kill the application if it does not exit " + "due to daemon threads.");
- return;
- }
- }
- }
-
- public JMSQueueSink(String qcfBindingName, String queueBindingName, String username, String password) {
-
- try {
- Properties env = new Properties();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
- env.put(Context.PROVIDER_URL, "tcp://localhost:61616");
- Context ctx = new InitialContext(env);
- QueueConnectionFactory queueConnectionFactory;
- queueConnectionFactory = (QueueConnectionFactory) lookup(ctx, qcfBindingName);
- System.out.println("Queue Cnx Factory found");
- Queue queue = (Queue) ctx.lookup(queueBindingName);
- System.out.println("Queue found: " + queue.getQueueName());
-
- QueueConnection queueConnection = queueConnectionFactory.createQueueConnection(username, password);
- System.out.println("Queue Connection created");
-
- QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageConsumer queueConsumer = queueSession.createConsumer(queue);
-
- queueConsumer.setMessageListener(this);
-
- queueConnection.start();
- System.out.println("Queue Connection started");
-
- } catch (Exception e) {
- logger.error("Could not read JMS message.", e);
- }
- }
-
- public void onMessage(javax.jms.Message message) {
- ILoggingEvent event;
- try {
- if (message instanceof ObjectMessage) {
- ObjectMessage objectMessage = (ObjectMessage) message;
- event = (ILoggingEvent) objectMessage.getObject();
- Logger log = (Logger) LoggerFactory.getLogger(event.getLoggerName());
- log.callAppenders(event);
- } else {
- logger.warn("Received message is of type " + message.getJMSType() + ", was expecting ObjectMessage.");
- }
- } catch (JMSException jmse) {
- logger.error("Exception thrown while processing incoming message.", jmse);
- }
- }
-
- protected Object lookup(Context ctx, String name) throws NamingException {
- try {
- return ctx.lookup(name);
- } catch (NameNotFoundException e) {
- logger.error("Could not find name [" + name + "].");
- throw e;
- }
- }
-
- static void usage(String msg) {
- System.err.println(msg);
- System.err.println("Usage: java " + JMSQueueSink.class.getName() + " QueueConnectionFactoryBindingName QueueBindingName Username Password");
- System.exit(1);
- }
-}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java 2016-02-25 21:15:37.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,205 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.Serializable;
-
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.naming.Context;
-
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.AppenderBase;
-import ch.qos.logback.core.net.JMSAppenderBase;
-import ch.qos.logback.core.spi.PreSerializationTransformer;
-
-/**
- * A simple appender that publishes events to a JMS Topic. The events are
- * serialized and transmitted as JMS message type {@link
- * javax.jms.ObjectMessage}.
- *
- * For more information about this appender, please refer to
- * http://logback.qos.ch/manual/appenders.html#JMSTopicAppender
- *
- * @author Ceki Gülcü
- */
-public class JMSTopicAppender extends JMSAppenderBase {
-
- static int SUCCESSIVE_FAILURE_LIMIT = 3;
-
- String topicBindingName;
- String tcfBindingName;
- TopicConnection topicConnection;
- TopicSession topicSession;
- TopicPublisher topicPublisher;
-
- int successiveFailureCount = 0;
-
- private PreSerializationTransformer pst = new LoggingEventPreSerializationTransformer();
-
- /**
- * The TopicConnectionFactoryBindingName option takes a string value.
- * Its value will be used to lookup the appropriate
- * TopicConnectionFactory from the JNDI context.
- */
- public void setTopicConnectionFactoryBindingName(String tcfBindingName) {
- this.tcfBindingName = tcfBindingName;
- }
-
- /**
- * Returns the value of the TopicConnectionFactoryBindingName option.
- */
- public String getTopicConnectionFactoryBindingName() {
- return tcfBindingName;
- }
-
- /**
- * The TopicBindingName option takes a string value. Its value will be
- * used to lookup the appropriate Topic from the JNDI context.
- */
- public void setTopicBindingName(String topicBindingName) {
- this.topicBindingName = topicBindingName;
- }
-
- /**
- * Returns the value of the TopicBindingName option.
- */
- public String getTopicBindingName() {
- return topicBindingName;
- }
-
- /**
- * Options are activated and become effective only after calling this method.
- */
- public void start() {
- TopicConnectionFactory topicConnectionFactory;
-
- try {
- Context jndi = buildJNDIContext();
-
- // addInfo("Looking up [" + tcfBindingName + "]");
- topicConnectionFactory = (TopicConnectionFactory) lookup(jndi, tcfBindingName);
- // addInfo("About to create TopicConnection.");
- if (userName != null) {
- this.topicConnection = topicConnectionFactory.createTopicConnection(userName, password);
- } else {
- this.topicConnection = topicConnectionFactory.createTopicConnection();
- }
-
- // addInfo(
- // "Creating TopicSession, non-transactional, "
- // + "in AUTO_ACKNOWLEDGE mode.");
- this.topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // addInfo("Looking up topic name [" + topicBindingName + "].");
- Topic topic = (Topic) lookup(jndi, topicBindingName);
-
- // addInfo("Creating TopicPublisher.");
- this.topicPublisher = topicSession.createPublisher(topic);
-
- // addInfo("Starting TopicConnection.");
- topicConnection.start();
-
- jndi.close();
- } catch (Exception e) {
- addError("Error while activating options for appender named [" + name + "].", e);
- }
-
- if (this.topicConnection != null && this.topicSession != null && this.topicPublisher != null) {
- super.start();
- }
- }
-
- /**
- * Close this JMSAppender. Closing releases all resources used by the
- * appender. A closed appender cannot be re-opened.
- */
- public synchronized void stop() {
- // The synchronized modifier avoids concurrent append and close operations
- if (!this.started) {
- return;
- }
-
- this.started = false;
-
- try {
- if (topicSession != null) {
- topicSession.close();
- }
- if (topicConnection != null) {
- topicConnection.close();
- }
- } catch (Exception e) {
- addError("Error while closing JMSAppender [" + name + "].", e);
- }
-
- // Help garbage collection
- topicPublisher = null;
- topicSession = null;
- topicConnection = null;
- }
-
- /**
- * This method called by {@link AppenderBase#doAppend} method to do most
- * of the real appending work.
- */
- public void append(ILoggingEvent event) {
- if (!isStarted()) {
- return;
- }
-
- try {
- ObjectMessage msg = topicSession.createObjectMessage();
- Serializable so = pst.transform(event);
- msg.setObject(so);
- topicPublisher.publish(msg);
- successiveFailureCount = 0;
- } catch (Exception e) {
- successiveFailureCount++;
- if (successiveFailureCount > SUCCESSIVE_FAILURE_LIMIT) {
- stop();
- }
- addError("Could not publish message in JMSTopicAppender [" + name + "].", e);
- }
- }
-
- /**
- * Returns the TopicConnection used for this appender. Only valid after
- * start() method has been invoked.
- */
- protected TopicConnection getTopicConnection() {
- return topicConnection;
- }
-
- /**
- * Returns the TopicSession used for this appender. Only valid after start()
- * method has been invoked.
- */
- protected TopicSession getTopicSession() {
- return topicSession;
- }
-
- /**
- * Returns the TopicPublisher used for this appender. Only valid after start()
- * method has been invoked.
- */
- protected TopicPublisher getTopicPublisher() {
- return topicPublisher;
- }
-}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicSink.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicSink.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicSink.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicSink.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,141 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.Properties;
-
-import javax.jms.JMSException;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-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.classic.util.ContextInitializer;
-
-/**
- * A simple application that consumes logging events sent by a {@link
- * JMSTopicAppender}.
- *
- * @author Ceki Gülcü
- */
-public class JMSTopicSink implements javax.jms.MessageListener {
-
- private Logger logger = (Logger) LoggerFactory.getLogger(JMSTopicSink.class);
-
- static public void main(String[] args) throws Exception {
- if (args.length < 2) {
- usage("Wrong number of arguments.");
- }
-
- String tcfBindingName = args[0];
- String topicBindingName = args[1];
- String username = null;
- String password = null;
- if (args.length == 4) {
- username = args[2];
- password = args[3];
- }
-
- LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
- new ContextInitializer(loggerContext).autoConfig();
-
- new JMSTopicSink(tcfBindingName, topicBindingName, username, password);
-
- BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
- // Loop until the word "exit" is typed
- System.out.println("Type \"exit\" to quit JMSTopicSink.");
- while (true) {
- String s = stdin.readLine();
- if (s.equalsIgnoreCase("exit")) {
- System.out.println("Exiting. Kill the application if it does not exit " + "due to daemon threads.");
- return;
- }
- }
- }
-
- public JMSTopicSink(String tcfBindingName, String topicBindingName, String username, String password) {
-
- try {
- Properties env = new Properties();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
- env.put(Context.PROVIDER_URL, "tcp://localhost:61616");
- Context ctx = new InitialContext(env);
- TopicConnectionFactory topicConnectionFactory;
- topicConnectionFactory = (TopicConnectionFactory) lookup(ctx, tcfBindingName);
- System.out.println("Topic Cnx Factory found");
- Topic topic = (Topic) ctx.lookup(topicBindingName);
- System.out.println("Topic found: " + topic.getTopicName());
-
- TopicConnection topicConnection = topicConnectionFactory.createTopicConnection(username, password);
- System.out.println("Topic Connection created");
-
- TopicSession topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-
- TopicSubscriber topicSubscriber = topicSession.createSubscriber(topic);
-
- topicSubscriber.setMessageListener(this);
-
- topicConnection.start();
- System.out.println("Topic Connection started");
-
- } catch (Exception e) {
- logger.error("Could not read JMS message.", e);
- }
- }
-
- public void onMessage(javax.jms.Message message) {
- ILoggingEvent event;
- try {
- if (message instanceof ObjectMessage) {
- ObjectMessage objectMessage = (ObjectMessage) message;
- event = (ILoggingEvent) objectMessage.getObject();
- Logger log = (Logger) LoggerFactory.getLogger(event.getLoggerName());
- log.callAppenders(event);
- } else {
- logger.warn("Received message is of type " + message.getJMSType() + ", was expecting ObjectMessage.");
- }
- } catch (JMSException jmse) {
- logger.error("Exception thrown while processing incoming message.", jmse);
- }
- }
-
- protected Object lookup(Context ctx, String name) throws NamingException {
- try {
- return ctx.lookup(name);
- } catch (NameNotFoundException e) {
- logger.error("Could not find name [" + name + "].");
- throw e;
- }
- }
-
- static void usage(String msg) {
- System.err.println(msg);
- System.err.println("Usage: java " + JMSTopicSink.class.getName() + " TopicConnectionFactoryBindingName TopicBindingName Username Password");
- System.exit(1);
- }
-}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/server/HardenedLoggingEventInputStream.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/server/HardenedLoggingEventInputStream.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/server/HardenedLoggingEventInputStream.java 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/server/HardenedLoggingEventInputStream.java 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,56 @@
+package ch.qos.logback.classic.net.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.helpers.BasicMarker;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.spi.ClassPackagingData;
+import ch.qos.logback.classic.spi.IThrowableProxy;
+import ch.qos.logback.classic.spi.LoggerContextVO;
+import ch.qos.logback.classic.spi.LoggerRemoteView;
+import ch.qos.logback.classic.spi.LoggingEventVO;
+import ch.qos.logback.classic.spi.StackTraceElementProxy;
+import ch.qos.logback.classic.spi.ThrowableProxy;
+import ch.qos.logback.classic.spi.ThrowableProxyVO;
+import ch.qos.logback.core.net.HardenedObjectInputStream;
+
+public class HardenedLoggingEventInputStream extends HardenedObjectInputStream {
+
+ static final String ARRAY_PREFIX = "[L";
+
+ static public List getWhilelist() {
+ List whitelist = new ArrayList();
+ whitelist.add(LoggingEventVO.class.getName());
+ whitelist.add(LoggerContextVO.class.getName());
+ whitelist.add(LoggerRemoteView.class.getName());
+ whitelist.add(ThrowableProxyVO.class.getName());
+ whitelist.add(BasicMarker.class.getName());
+ whitelist.add(Level.class.getName());
+ whitelist.add(Logger.class.getName());
+ whitelist.add(StackTraceElement.class.getName());
+ whitelist.add(StackTraceElement[].class.getName());
+ whitelist.add(ThrowableProxy.class.getName());
+ whitelist.add(ThrowableProxy[].class.getName());
+ whitelist.add(IThrowableProxy.class.getName());
+ whitelist.add(IThrowableProxy[].class.getName());
+ whitelist.add(StackTraceElementProxy.class.getName());
+ whitelist.add(StackTraceElementProxy[].class.getName());
+ whitelist.add(ClassPackagingData.class.getName());
+
+ return whitelist;
+ }
+
+ public HardenedLoggingEventInputStream(InputStream is) throws IOException {
+ super(is, getWhilelist());
+ }
+
+ public HardenedLoggingEventInputStream(InputStream is, List additionalAuthorizedClasses) throws IOException {
+ this(is);
+ super.addToWhitelist(additionalAuthorizedClasses);
+ }
+}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClient.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClient.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClient.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/server/RemoteAppenderStreamClient.java 2017-03-30 02:48:10.000000000 +0000
@@ -16,12 +16,12 @@
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
-import java.io.ObjectInputStream;
import java.net.Socket;
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.HardenedObjectInputStream;
import ch.qos.logback.core.util.CloseUtil;
/**
@@ -87,7 +87,7 @@
*/
public void run() {
logger.info(this + ": connected");
- ObjectInputStream ois = null;
+ HardenedObjectInputStream ois = null;
try {
ois = createObjectInputStream();
while (true) {
@@ -120,11 +120,11 @@
}
}
- private ObjectInputStream createObjectInputStream() throws IOException {
+ private HardenedObjectInputStream createObjectInputStream() throws IOException {
if (inputStream != null) {
- return new ObjectInputStream(inputStream);
+ return new HardenedLoggingEventInputStream(inputStream);
}
- return new ObjectInputStream(socket.getInputStream());
+ return new HardenedLoggingEventInputStream(socket.getInputStream());
}
/**
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSocketServer.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSocketServer.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSocketServer.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SimpleSocketServer.java 2017-03-30 02:48:10.000000000 +0000
@@ -14,7 +14,6 @@
package ch.qos.logback.classic.net;
import java.io.IOException;
-import java.lang.reflect.Constructor;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAppender.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAppender.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAppender.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketAppender.java 2017-03-30 02:48:10.000000000 +0000
@@ -14,8 +14,6 @@
// Contributors: Dan MacDonald
package ch.qos.logback.classic.net;
-import java.net.InetAddress;
-
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.net.AbstractSocketAppender;
import ch.qos.logback.core.spi.PreSerializationTransformer;
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketNode.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketNode.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketNode.java 2016-02-25 21:15:40.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketNode.java 2017-03-30 02:48:10.000000000 +0000
@@ -15,13 +15,12 @@
import java.io.BufferedInputStream;
import java.io.IOException;
-import java.io.ObjectInputStream;
import java.net.Socket;
import java.net.SocketAddress;
import ch.qos.logback.classic.Logger;
-
import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.net.server.HardenedLoggingEventInputStream;
import ch.qos.logback.classic.spi.ILoggingEvent;
// Contributors: Moses Hohman
@@ -44,7 +43,7 @@
Socket socket;
LoggerContext context;
- ObjectInputStream ois;
+ HardenedLoggingEventInputStream hardenedLoggingEventInputStream;
SocketAddress remoteSocketAddress;
Logger logger;
@@ -68,7 +67,7 @@
public void run() {
try {
- ois = new ObjectInputStream(new BufferedInputStream(socket.getInputStream()));
+ hardenedLoggingEventInputStream = new HardenedLoggingEventInputStream(new BufferedInputStream(socket.getInputStream()));
} catch (Exception e) {
logger.error("Could not open ObjectInputStream to " + socket, e);
closed = true;
@@ -80,7 +79,7 @@
try {
while (!closed) {
// read an event from the wire
- event = (ILoggingEvent) ois.readObject();
+ event = (ILoggingEvent) hardenedLoggingEventInputStream.readObject();
// get a logger from the hierarchy. The name of the logger is taken to
// be the name contained in the event.
remoteLogger = context.getLogger(event.getLoggerName());
@@ -110,13 +109,13 @@
return;
}
closed = true;
- if (ois != null) {
+ if (hardenedLoggingEventInputStream != null) {
try {
- ois.close();
+ hardenedLoggingEventInputStream.close();
} catch (IOException e) {
logger.warn("Could not close connection.", e);
} finally {
- ois = null;
+ hardenedLoggingEventInputStream = null;
}
}
}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketReceiver.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketReceiver.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketReceiver.java 2016-03-11 21:53:25.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SocketReceiver.java 2017-03-30 02:48:10.000000000 +0000
@@ -28,6 +28,7 @@
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.net.server.HardenedLoggingEventInputStream;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.net.DefaultSocketConnector;
import ch.qos.logback.core.net.AbstractSocketAppender;
@@ -153,9 +154,10 @@
}
private void dispatchEvents(LoggerContext lc) {
+ ObjectInputStream ois = null;
try {
socket.setSoTimeout(acceptConnectionTimeout);
- ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+ ois = new HardenedLoggingEventInputStream(socket.getInputStream());
socket.setSoTimeout(0);
addInfo(receiverId + "connection established");
while (true) {
@@ -172,6 +174,7 @@
} catch (ClassNotFoundException ex) {
addInfo(receiverId + "unknown event class: " + ex);
} finally {
+ CloseUtil.closeQuietly(ois);
CloseUtil.closeQuietly(socket);
socket = null;
addInfo(receiverId + "connection closed");
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketAppender.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketAppender.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketAppender.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/net/SSLSocketAppender.java 2017-03-30 02:48:10.000000000 +0000
@@ -13,8 +13,6 @@
*/
package ch.qos.logback.classic.net;
-import java.net.InetAddress;
-
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.net.AbstractSSLSocketAppender;
import ch.qos.logback.core.spi.PreSerializationTransformer;
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/pattern/DateConverter.java 2017-03-30 02:48:10.000000000 +0000
@@ -47,7 +47,7 @@
cachingDateFormatter = new CachingDateFormatter(CoreConstants.ISO8601_PATTERN);
}
- List optionList = getOptionList();
+ List optionList = getOptionList();
// if the option list contains a TZ option, then set it.
if (optionList != null && optionList.size() > 1) {
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java 2017-03-30 02:48:10.000000000 +0000
@@ -52,7 +52,7 @@
return outputMDCForAllKeys(mdcPropertyMap);
} else {
- String value = event.getMDCPropertyMap().get(key);
+ String value = mdcPropertyMap.get(key);
if (value != null) {
return value;
} else {
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java 2016-02-25 21:15:37.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/selector/servlet/ContextDetachingSCL.java 2017-03-30 02:48:10.000000000 +0000
@@ -29,6 +29,10 @@
public class ContextDetachingSCL implements ServletContextListener {
+ public void contextInitialized(ServletContextEvent arg0) {
+ // do nothing
+ }
+
public void contextDestroyed(ServletContextEvent servletContextEvent) {
String loggerContextName = null;
@@ -59,8 +63,6 @@
}
}
- public void contextInitialized(ServletContextEvent arg0) {
- // do nothing
- }
+
}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializer.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializer.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializer.java 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializer.java 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,66 @@
+package ch.qos.logback.classic.servlet;
+
+import static ch.qos.logback.core.CoreConstants.DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY;
+
+import java.util.Set;
+
+import javax.servlet.ServletContainerInitializer;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory;
+import ch.qos.logback.core.util.OptionHelper;
+
+/**
+ * Attaches a new instance of {@link LogbackServletContextListener} to the current web-applications {@link ServletContext}.
+ *
+ * @author Ceki Gulcu
+ * @since 1.1.10
+ */
+public class LogbackServletContainerInitializer implements ServletContainerInitializer {
+
+ @Override
+ public void onStartup(Set> c, ServletContext ctx) throws ServletException {
+
+ if (isDisabledByConfiguration(ctx)) {
+ StatusViaSLF4JLoggerFactory.addInfo("Due to deployment instructions will NOT register an instance of " + LogbackServletContextListener.class
+ + " to the current web-app", this);
+
+ return;
+ }
+
+ StatusViaSLF4JLoggerFactory.addInfo("Adding an instance of " + LogbackServletContextListener.class + " to the current web-app", this);
+ LogbackServletContextListener lscl = new LogbackServletContextListener();
+ ctx.addListener(lscl);
+ }
+
+ /**
+ * Search for value of DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY in the web-app first, then as a system property and
+ * as an environment variable last.
+ *
+ * @param ctx
+ * @return True if value of DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY is available and set to "true", false otherwise.
+ */
+ boolean isDisabledByConfiguration(ServletContext ctx) {
+ String disableAttributeStr = null;
+ Object disableAttribute = ctx.getInitParameter(DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY);
+ if (disableAttribute instanceof String) {
+ disableAttributeStr = (String) disableAttribute;
+ }
+
+ if (OptionHelper.isEmpty(disableAttributeStr)) {
+ disableAttributeStr = OptionHelper.getSystemProperty(DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY);
+ }
+
+ if (OptionHelper.isEmpty(disableAttributeStr)) {
+ disableAttributeStr = OptionHelper.getEnv(DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY);
+ }
+
+ if (OptionHelper.isEmpty(disableAttributeStr))
+ return false;
+
+ return disableAttributeStr.equalsIgnoreCase("true");
+
+ }
+
+}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContextListener.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContextListener.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContextListener.java 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/servlet/LogbackServletContextListener.java 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,40 @@
+package ch.qos.logback.classic.servlet;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory;
+import ch.qos.logback.core.spi.ContextAwareBase;
+
+/**
+ * Allows for graceful shutdown of the {@link LoggerContext} associated with this web-app.
+ *
+ * @author Ceki Gulcu
+ * @since 1.1.10
+ */
+public class LogbackServletContextListener implements ServletContextListener {
+
+ ContextAwareBase contextAwareBase = new ContextAwareBase();
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+
+ ILoggerFactory iLoggerFactory = LoggerFactory.getILoggerFactory();
+ if (iLoggerFactory instanceof LoggerContext) {
+ LoggerContext loggerContext = (LoggerContext) iLoggerFactory;
+ contextAwareBase.setContext(loggerContext);
+ StatusViaSLF4JLoggerFactory.addInfo("About to stop " + loggerContext.getClass().getCanonicalName() + " [" + loggerContext.getName() + "]", this);
+ loggerContext.stop();
+ }
+ }
+
+}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java 2016-02-29 19:51:06.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java 2017-03-30 02:48:10.000000000 +0000
@@ -122,12 +122,12 @@
return url;
}
- url = getResource(GROOVY_AUTOCONFIG_FILE, myClassLoader, updateStatus);
+ url = getResource(TEST_AUTOCONFIG_FILE, myClassLoader, updateStatus);
if (url != null) {
return url;
}
- url = getResource(TEST_AUTOCONFIG_FILE, myClassLoader, updateStatus);
+ url = getResource(GROOVY_AUTOCONFIG_FILE, myClassLoader, updateStatus);
if (url != null) {
return url;
}
diff -Nru logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/util/StatusViaSLF4JLoggerFactory.java logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/util/StatusViaSLF4JLoggerFactory.java
--- logback-1.1.9/logback-classic/src/main/java/ch/qos/logback/classic/util/StatusViaSLF4JLoggerFactory.java 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/util/StatusViaSLF4JLoggerFactory.java 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,40 @@
+package ch.qos.logback.classic.util;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.status.ErrorStatus;
+import ch.qos.logback.core.status.InfoStatus;
+import ch.qos.logback.core.status.Status;
+
+/**
+ * Add a status message to the {@link LoggerContext} returned by {@link LoggerFactory#getILoggerFactory}.
+ * @author ceki
+ * @since 1.1.10
+ */
+public class StatusViaSLF4JLoggerFactory {
+
+ public static void addInfo(String msg, Object o) {
+ addStatus(new InfoStatus(msg, o));
+ }
+
+ public static void addError(String msg, Object o) {
+ addStatus(new ErrorStatus(msg, o));
+ }
+
+ public static void addError(String msg, Object o, Throwable t) {
+ addStatus(new ErrorStatus(msg, o, t));
+ }
+
+ public static void addStatus(Status status) {
+ ILoggerFactory iLoggerFactory = LoggerFactory.getILoggerFactory();
+ if (iLoggerFactory instanceof LoggerContext) {
+ ContextAwareBase contextAwareBase = new ContextAwareBase();
+ LoggerContext loggerContext = (LoggerContext) iLoggerFactory;
+ contextAwareBase.setContext(loggerContext);
+ contextAwareBase.addStatus(status);
+ }
+ }
+}
diff -Nru logback-1.1.9/logback-classic/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer logback-1.2.3/logback-classic/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer
--- logback-1.1.9/logback-classic/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1 @@
+ch.qos.logback.classic.servlet.LogbackServletContainerInitializer
\ No newline at end of file
diff -Nru logback-1.1.9/logback-classic/src/test/input/issue/logback-1159.xml logback-1.2.3/logback-classic/src/test/input/issue/logback-1159.xml
--- logback-1.1.9/logback-classic/src/test/input/issue/logback-1159.xml 2016-05-10 10:28:24.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/input/issue/logback-1159.xml 2017-03-30 02:48:10.000000000 +0000
@@ -1,30 +1,30 @@
-
-
-
-
-
-
-
-
-
-
- target/test.log
-
-
-
- target/test.${logback.rollingPattern}.log
-
- 30
-
-
- %m%n
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ target/test.log
+
+
+
+ target/test.${logback.rollingPattern}.log
+
+ 30
+
+
+ %m%n
+
+
+
+
+
+
+
+
diff -Nru logback-1.1.9/logback-classic/src/test/input/joran/compatibility/immediateFlushInEncoder.xml logback-1.2.3/logback-classic/src/test/input/joran/compatibility/immediateFlushInEncoder.xml
--- logback-1.1.9/logback-classic/src/test/input/joran/compatibility/immediateFlushInEncoder.xml 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/input/joran/compatibility/immediateFlushInEncoder.xml 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,16 @@
+
+
+
+ target/test-output/layoutInsteadOfEncoder.log
+ true
+
+
+ ${immediateFlush}
+ %msg%n
+
+
+
+
+
+
+
\ No newline at end of file
diff -Nru logback-1.1.9/logback-classic/src/test/input/joran/hostnameProperty.xml logback-1.2.3/logback-classic/src/test/input/joran/hostnameProperty.xml
--- logback-1.1.9/logback-classic/src/test/input/joran/hostnameProperty.xml 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/input/joran/hostnameProperty.xml 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,4 @@
+
+
+
+
diff -Nru logback-1.1.9/logback-classic/src/test/input/joran/issues/logback-1277.xml logback-1.2.3/logback-classic/src/test/input/joran/issues/logback-1277.xml
--- logback-1.1.9/logback-classic/src/test/input/joran/issues/logback-1277.xml 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/input/joran/issues/logback-1277.xml 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+ /var/log/logbook-%d{yyyy-MM-dd}-%i.log
+
+ 16MB
+ 2
+ 2500MB
+
+
+
+ %d{"ISO8601","Europe/Berlin"} [%contextName %X{server}] %relative [%thread] %-5level %logger{35} - %msg%n
+
+
+
+
+
+
+
\ No newline at end of file
diff -Nru logback-1.1.9/logback-classic/src/test/input/joran/pattern/replaceNewline.xml logback-1.2.3/logback-classic/src/test/input/joran/pattern/replaceNewline.xml
--- logback-1.1.9/logback-classic/src/test/input/joran/pattern/replaceNewline.xml 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/input/joran/pattern/replaceNewline.xml 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ %replace(%msg){'(\n)', '$1${TAB}'}
+
+
+
+
+
+
+
\ No newline at end of file
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java 2016-02-25 21:15:37.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java 2017-03-30 02:48:10.000000000 +0000
@@ -22,8 +22,8 @@
import java.util.Properties;
import org.hsqldb.Server;
-import org.hsqldb.ServerConstants;
import org.hsqldb.jdbcDriver;
+import org.hsqldb.server.ServerConstants;
public class DBAppenderHSQLTestFixture {
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -15,6 +15,7 @@
import static ch.qos.logback.core.CoreConstants.CODES_URL;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
@@ -58,4 +59,32 @@
assertTrue(fileAppender.isStarted());
assertTrue(fileAppender.getEncoder() instanceof LayoutWrappingEncoder);
}
+
+ @Test
+ public void immediateFlushInEncoder_TRUE() throws JoranException {
+ immediateFlushInEncoder(true);
+ }
+
+ @Test
+ public void immediateFlushInEncoder_FALSE() throws JoranException {
+ immediateFlushInEncoder(false);
+ }
+
+ public void immediateFlushInEncoder(Boolean immediateFlush) throws JoranException {
+ loggerContext.putProperty("immediateFlush", immediateFlush.toString());
+ jc.doConfigure(ClassicTestConstants.JORAN_INPUT_PREFIX + "compatibility/immediateFlushInEncoder.xml");
+ StatusPrinter.print(loggerContext);
+ StatusChecker checker = new StatusChecker(loggerContext);
+
+ checker.assertContainsMatch(Status.WARN, "As of version 1.2.0 \"immediateFlush\" property should be set within the enclosing Appender.");
+ checker.assertContainsMatch(Status.WARN, "Please move \"immediateFlush\" property into the enclosing appender.");
+ checker.assertContainsMatch(Status.WARN, "Setting the \"immediateFlush\" property of the enclosing appender to "+immediateFlush);
+
+ ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
+ FileAppender fileAppender = (FileAppender) root.getAppender("LIOE");
+ assertTrue(fileAppender.isStarted());
+ assertEquals(immediateFlush, Boolean.valueOf(fileAppender.isImmediateFlush()));
+ }
+
+
}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/encoder/PatternLayoutEncoderTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/encoder/PatternLayoutEncoderTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/encoder/PatternLayoutEncoderTest.java 2016-02-25 21:15:37.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/encoder/PatternLayoutEncoderTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -52,15 +52,17 @@
init(baos);
String msg = "hello";
ILoggingEvent event = makeLoggingEvent(msg);
- ple.doEncode(event);
- ple.close();
+ byte[] eventBytes = ple.encode(event);
+ baos.write(eventBytes);
+ ple.footerBytes();
assertEquals(msg, baos.toString());
}
void init(ByteArrayOutputStream baos) throws IOException {
ple.start();
((PatternLayout) ple.getLayout()).setOutputPatternAsHeader(false);
- ple.init(baos);
+ byte[] header = ple.headerBytes();
+ baos.write(header);
}
@Test
@@ -69,9 +71,10 @@
init(baos);
String msg = "\u03b1";
ILoggingEvent event = makeLoggingEvent(msg);
- ple.doEncode(event);
- ple.close();
- assertEquals(msg, new String(baos.toByteArray(), utf8Charset.name()));
+ byte[] eventBytes = ple.encode(event);
+ baos.write(eventBytes);
+ ple.footerBytes();
+ assertEquals(msg, new String(baos.toByteArray(), utf8Charset));
}
}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/issue/logback_1277/Main.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/issue/logback_1277/Main.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/issue/logback_1277/Main.java 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/issue/logback_1277/Main.java 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,47 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2015, QOS.ch. All rights 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.issue.logback_1277;
+
+import ch.qos.logback.classic.ClassicTestConstants;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.joran.JoranConfigurator;
+import ch.qos.logback.core.joran.spi.JoranException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Main {
+
+ static Logger logger = LoggerFactory.getLogger(Main.class);
+ static String CONFIG_FILE = ClassicTestConstants.ISSUES_PREFIX + "logback-1277.xml";
+
+ public static void main(String[] args) throws JoranException, InterruptedException {
+ init(CONFIG_FILE);
+ int runLen = 1000 * 1000;
+ for (int i = 0; i < runLen; i++) {
+ logger.debug("hello");
+ }
+ System.out.println("Will sleep for 60 seconds");
+ Thread.sleep(1000 * 60);
+ System.out.println("Exiting");
+
+ }
+
+ static void init(String file) throws JoranException {
+ LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
+ JoranConfigurator jc = new JoranConfigurator();
+ jc.setContext(loggerContext);
+ loggerContext.reset();
+ jc.doConfigure(file);
+ }
+}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java 2016-03-29 19:36:31.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/joran/JoranConfiguratorTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -390,7 +390,6 @@
@Test
public void properties() throws JoranException {
String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "properties.xml";
- assertNull(loggerContext.getProperty(CoreConstants.HOSTNAME_KEY));
assertNull(System.getProperty("sys"));
configure(configFileAsStr);
@@ -403,6 +402,13 @@
checker.assertIsErrorFree();
}
+ @Test
+ public void hostnameProperty() throws JoranException {
+ String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "hostnameProperty.xml";
+ configure(configFileAsStr);
+ assertEquals("A", loggerContext.getProperty(CoreConstants.HOSTNAME_KEY));
+ }
+
// see also http://jira.qos.ch/browse/LBCORE-254
@Test
public void sysProps() throws JoranException {
@@ -427,8 +433,7 @@
configure(configFileAsStr);
assertTrue(loggerContext.isPackagingDataEnabled());
}
-
-
+
@Test
public void valueOfConvention() throws JoranException {
String configFileAsStr = ClassicTestConstants.JORAN_INPUT_PREFIX + "valueOfConvention.xml";
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/LoggerSerializationTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/LoggerSerializationTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/LoggerSerializationTest.java 2016-02-25 21:15:40.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/LoggerSerializationTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -13,16 +13,25 @@
*/
package ch.qos.logback.classic;
-import java.io.*;
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.List;
-import ch.qos.logback.core.util.CoreTestConstants;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.LoggerFactory;
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import ch.qos.logback.classic.net.server.HardenedLoggingEventInputStream;
+import ch.qos.logback.core.net.HardenedObjectInputStream;
+import ch.qos.logback.core.util.CoreTestConstants;
public class LoggerSerializationTest {
@@ -35,8 +44,9 @@
ByteArrayOutputStream bos;
ObjectOutputStream oos;
- ObjectInputStream inputStream;
-
+ HardenedLoggingEventInputStream hardenedLoggingEventInputStream;
+ List whitelist = new ArrayList();
+
@Before
public void setUp() throws Exception {
lc = new LoggerContext();
@@ -45,6 +55,7 @@
// create the byte output stream
bos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bos);
+ whitelist.add(Foo.class.getName());
}
@After
@@ -110,17 +121,17 @@
private Foo writeAndRead(Foo foo) throws IOException, ClassNotFoundException {
writeObject(oos, foo);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
- inputStream = new ObjectInputStream(bis);
- Foo fooBack = readFooObject(inputStream);
- inputStream.close();
+ hardenedLoggingEventInputStream = new HardenedLoggingEventInputStream(bis, whitelist);
+ Foo fooBack = readFooObject(hardenedLoggingEventInputStream);
+ hardenedLoggingEventInputStream.close();
return fooBack;
}
- Foo readFooObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
+ Foo readFooObject(HardenedObjectInputStream inputStream) throws IOException, ClassNotFoundException {
return (Foo) readObject(inputStream);
}
- private Object readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
+ private Object readObject(HardenedObjectInputStream inputStream) throws IOException, ClassNotFoundException {
return inputStream.readObject();
}
@@ -133,7 +144,7 @@
@Test
public void testCompatibilityWith_v1_0_11() throws IOException, ClassNotFoundException {
FileInputStream fis = new FileInputStream(SERIALIZATION_PREFIX + "logger_v1.0.11.ser");
- ObjectInputStream ois = new ObjectInputStream(fis);
+ HardenedObjectInputStream ois = new HardenedLoggingEventInputStream(fis); // new String[] {Logger.class.getName(), LoggerRemoteView.class.getName()});
Logger a = (Logger) ois.readObject();
ois.close();
assertEquals("a", a.getName());
@@ -145,7 +156,7 @@
@Test
public void testCompatibilityWith_v1_0_12() throws IOException, ClassNotFoundException {
FileInputStream fis = new FileInputStream(SERIALIZATION_PREFIX + "logger_v1.0.12.ser");
- ObjectInputStream ois = new ObjectInputStream(fis);
+ HardenedObjectInputStream ois = new HardenedObjectInputStream(fis, new String[] {Logger.class.getName()});
Logger a = (Logger) ois.readObject();
ois.close();
assertEquals("a", a.getName());
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTestApp.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTestApp.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTestApp.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTestApp.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,61 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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 org.slf4j.LoggerFactory;
-
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.core.util.StatusPrinter;
-
-public class JMSQueueAppenderTestApp {
-
- public static void main(String[] args) {
- Logger logger = (Logger) LoggerFactory.getLogger(JMSTopicAppenderTestApp.class);
- LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
- lc.reset();
-
- JMSQueueAppender appender = new JMSQueueAppender();
- appender.setContext(lc);
- appender.setName("jmsQueue");
- appender.setInitialContextFactoryName("org.apache.activemq.jndi.ActiveMQInitialContextFactory");
- // appender.setPassword("");
- appender.setProviderURL("tcp://localhost:61616");
- // appender.setSecurityCredentials("");
- // appender.setSecurityPrincipalName("");
- appender.setQueueBindingName("MyQueue");
- appender.setQueueConnectionFactoryBindingName("ConnectionFactory");
- // appender.setURLPkgPrefixes("");
- // appender.setUserName("");
-
- appender.start();
- logger.addAppender(appender);
-
- // JIT
- for (int i = 0; i < 10000; i++) {
- logger.debug("** Hello world. n=" + i);
- }
-
- long before = System.nanoTime();
- for (int i = 0; i < 10000; i++) {
- logger.debug("** Hello world. n=" + i);
- }
- long after = System.nanoTime();
-
- System.out.println("Time per logs for 10'000 logs: " + (after - before) / 10000);
-
- StatusPrinter.print(lc.getStatusManager());
- }
-
-}
\ No newline at end of file
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java 2016-02-25 21:15:40.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSQueueAppenderTest.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,143 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.Serializable;
-
-import javax.jms.ObjectMessage;
-
-import junit.framework.TestCase;
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.net.mock.MockQueue;
-import ch.qos.logback.classic.net.mock.MockQueueConnectionFactory;
-import ch.qos.logback.classic.net.mock.MockQueueSender;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.classic.spi.LoggingEvent;
-import ch.qos.logback.classic.util.MockInitialContext;
-import ch.qos.logback.classic.util.MockInitialContextFactory;
-import ch.qos.logback.core.ContextBase;
-import ch.qos.logback.core.spi.PreSerializationTransformer;
-
-public class JMSQueueAppenderTest extends TestCase {
-
- ch.qos.logback.core.Context context;
- JMSQueueAppender appender;
- PreSerializationTransformer pst = new LoggingEventPreSerializationTransformer();
-
- @Override
- protected void setUp() throws Exception {
- context = new ContextBase();
- appender = new JMSQueueAppender();
- appender.setContext(context);
- appender.setName("jmsQueue");
- appender.qcfBindingName = "queueCnxFactory";
- appender.queueBindingName = "testQueue";
- appender.setProviderURL("url");
- appender.setInitialContextFactoryName(MockInitialContextFactory.class.getName());
-
- MockInitialContext mic = MockInitialContextFactory.getContext();
- mic.map.put(appender.qcfBindingName, new MockQueueConnectionFactory());
- mic.map.put(appender.queueBindingName, new MockQueue(appender.queueBindingName));
-
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- appender = null;
- context = null;
- super.tearDown();
- }
-
- public void testAppendOk() {
- appender.start();
-
- ILoggingEvent le = createLoggingEvent();
- appender.append(le);
-
- MockQueueSender qs = (MockQueueSender) appender.queueSender;
- assertEquals(1, qs.getMessageList().size());
- ObjectMessage message = (ObjectMessage) qs.getMessageList().get(0);
- try {
- Serializable witness = pst.transform(le);
- assertEquals(witness, message.getObject());
- } catch (Exception e) {
- fail();
- }
- }
-
- public void testAppendFailure() {
- appender.start();
-
- // make sure the append method does not work
- appender.queueSender = null;
-
- ILoggingEvent le = createLoggingEvent();
- for (int i = 1; i <= 3; i++) {
- appender.append(le);
- assertEquals(i, context.getStatusManager().getCount());
- assertTrue(appender.isStarted());
- }
- appender.append(le);
- assertEquals(4, context.getStatusManager().getCount());
- assertFalse(appender.isStarted());
- }
-
- public void testStartMinimalInfo() {
- // let's leave only what's in the setup()
- // method, minus the providerURL
- appender.setProviderURL(null);
- appender.start();
-
- assertTrue(appender.isStarted());
-
- try {
- assertEquals(appender.queueBindingName, appender.queueSender.getQueue().getQueueName());
- } catch (Exception e) {
- fail();
- }
- }
-
- public void testStartUserPass() {
- appender.setUserName("test");
- appender.setPassword("test");
-
- appender.start();
-
- assertTrue(appender.isStarted());
-
- try {
- assertEquals(appender.queueBindingName, appender.queueSender.getQueue().getQueueName());
- } catch (Exception e) {
- fail();
- }
- }
-
- public void testStartFails() {
- appender.queueBindingName = null;
-
- appender.start();
-
- assertFalse(appender.isStarted());
- }
-
- private ILoggingEvent createLoggingEvent() {
- LoggingEvent le = new LoggingEvent();
- le.setLevel(Level.DEBUG);
- le.setMessage("test message");
- le.setTimeStamp(System.currentTimeMillis());
- le.setThreadName(Thread.currentThread().getName());
- return le;
- }
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTestApp.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTestApp.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTestApp.java 2016-02-25 21:15:37.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTestApp.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,61 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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 org.slf4j.LoggerFactory;
-
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.core.util.StatusPrinter;
-
-public class JMSTopicAppenderTestApp {
-
- public static void main(String[] args) {
- Logger logger = (Logger) LoggerFactory.getLogger(JMSTopicAppenderTestApp.class);
- LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
- lc.reset();
-
- JMSTopicAppender appender = new JMSTopicAppender();
- appender.setContext(lc);
- appender.setName("jmsTopic");
- appender.setInitialContextFactoryName("org.apache.activemq.jndi.ActiveMQInitialContextFactory");
- // appender.setPassword("");
- appender.setProviderURL("tcp://localhost:61616");
- // appender.setSecurityCredentials("");
- // appender.setSecurityPrincipalName("");
- appender.setTopicBindingName("MyTopic");
- appender.setTopicConnectionFactoryBindingName("ConnectionFactory");
- // appender.setURLPkgPrefixes("");
- // appender.setUserName("");
-
- appender.start();
- logger.addAppender(appender);
-
- // JIT
- for (int i = 0; i < 10000; i++) {
- logger.debug("** Hello world. n=" + i);
- }
-
- long before = System.nanoTime();
- for (int i = 0; i < 10000; i++) {
- logger.debug("** Hello world. n=" + i);
- }
- long after = System.nanoTime();
-
- System.out.println("Time per logs for 10'000 logs: " + (after - before) / 10000);
-
- StatusPrinter.print(lc.getStatusManager());
- }
-
-}
\ No newline at end of file
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/JMSTopicAppenderTest.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,230 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.Serializable;
-import java.util.Properties;
-
-import javax.jms.ObjectMessage;
-import javax.naming.Context;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.net.mock.MockTopic;
-import ch.qos.logback.classic.net.mock.MockTopicConnectionFactory;
-import ch.qos.logback.classic.net.mock.MockTopicPublisher;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.classic.spi.LoggingEvent;
-import ch.qos.logback.classic.util.MockInitialContext;
-import ch.qos.logback.classic.util.MockInitialContextFactory;
-import ch.qos.logback.core.ContextBase;
-import ch.qos.logback.core.spi.PreSerializationTransformer;
-
-public class JMSTopicAppenderTest {
-
- ch.qos.logback.core.Context context;
- JMSTopicAppender appender;
- PreSerializationTransformer pst = new LoggingEventPreSerializationTransformer();
-
- @Before
- public void setUp() throws Exception {
- context = new ContextBase();
- appender = new JMSTopicAppender();
- appender.setContext(context);
- appender.setName("jmsTopic");
- appender.tcfBindingName = "topicCnxFactory";
- appender.topicBindingName = "testTopic";
- appender.setProviderURL("url");
- appender.setInitialContextFactoryName(MockInitialContextFactory.class.getName());
-
- MockInitialContext mic = MockInitialContextFactory.getContext();
- mic.map.put(appender.tcfBindingName, new MockTopicConnectionFactory());
- mic.map.put(appender.topicBindingName, new MockTopic(appender.topicBindingName));
-
- }
-
- @After
- public void tearDown() throws Exception {
- appender = null;
- context = null;
- }
-
- @Test
- public void testAppendOk() {
- appender.start();
-
- ILoggingEvent le = createLoggingEvent();
- appender.append(le);
-
- MockTopicPublisher tp = (MockTopicPublisher) appender.topicPublisher;
- assertEquals(1, tp.getMessageList().size());
- ObjectMessage message = (ObjectMessage) tp.getMessageList().get(0);
- try {
- Serializable witness = pst.transform(le);
- assertEquals(witness, message.getObject());
- } catch (Exception e) {
- fail();
- }
- }
-
- @Test
- public void testAppendFailure() {
- appender.start();
-
- // make sure the append method does not work
- appender.topicPublisher = null;
-
- ILoggingEvent le = createLoggingEvent();
- for (int i = 1; i <= 3; i++) {
- appender.append(le);
- assertEquals(i, context.getStatusManager().getCount());
- assertTrue(appender.isStarted());
- }
- appender.append(le);
- assertEquals(4, context.getStatusManager().getCount());
- assertFalse(appender.isStarted());
- }
-
- @Test
- public void testBuildEnvProperties() {
- appender.setInitialContextFactoryName("icfn");
- appender.setProviderURL("url");
- appender.setURLPkgPrefixes("pkgPref");
- appender.setSecurityPrincipalName("user");
- appender.setSecurityCredentials("cred");
-
- Properties props = appender.buildEnvProperties();
- assertEquals(5, props.size());
- assertEquals(appender.getInitialContextFactoryName(), props.getProperty(Context.INITIAL_CONTEXT_FACTORY));
- assertEquals(appender.getProviderURL(), props.getProperty(Context.PROVIDER_URL));
- assertEquals(appender.getURLPkgPrefixes(), props.getProperty(Context.URL_PKG_PREFIXES));
- assertEquals(appender.getSecurityPrincipalName(), props.getProperty(Context.SECURITY_PRINCIPAL));
- assertEquals(appender.getSecurityCredentials(), props.getProperty(Context.SECURITY_CREDENTIALS));
- }
-
- @Test
- public void testBuildEnvPropertiesWithNullProviderURL() {
- appender.setInitialContextFactoryName("icfn");
- appender.setProviderURL(null);
- appender.setURLPkgPrefixes("pkgPref");
- appender.setSecurityPrincipalName("user");
- appender.setSecurityCredentials("cred");
-
- Properties props = appender.buildEnvProperties();
- assertEquals(4, props.size());
- assertEquals(appender.getInitialContextFactoryName(), props.getProperty(Context.INITIAL_CONTEXT_FACTORY));
- assertEquals(null, props.getProperty(Context.PROVIDER_URL));
- assertEquals(appender.getURLPkgPrefixes(), props.getProperty(Context.URL_PKG_PREFIXES));
- assertEquals(appender.getSecurityPrincipalName(), props.getProperty(Context.SECURITY_PRINCIPAL));
- assertEquals(appender.getSecurityCredentials(), props.getProperty(Context.SECURITY_CREDENTIALS));
-
- assertEquals(1, context.getStatusManager().getCount());
- }
-
- @Test
- public void testBuildEnvPropertiesWithNullCredentials() {
- appender.setInitialContextFactoryName("icfn");
- appender.setProviderURL("url");
- appender.setURLPkgPrefixes("pkgPref");
- appender.setSecurityPrincipalName("user");
- appender.setSecurityCredentials(null);
-
- Properties props = appender.buildEnvProperties();
- assertEquals(4, props.size());
- assertEquals(appender.getInitialContextFactoryName(), props.getProperty(Context.INITIAL_CONTEXT_FACTORY));
- assertEquals(appender.getProviderURL(), props.getProperty(Context.PROVIDER_URL));
- assertEquals(appender.getURLPkgPrefixes(), props.getProperty(Context.URL_PKG_PREFIXES));
- assertEquals(appender.getSecurityPrincipalName(), props.getProperty(Context.SECURITY_PRINCIPAL));
- assertEquals(null, props.getProperty(Context.SECURITY_CREDENTIALS));
-
- assertEquals(1, context.getStatusManager().getCount());
- }
-
- @Test
- public void testBuildEnvPropertiesWithPkgNull() {
- appender.setInitialContextFactoryName("icfn");
- appender.setProviderURL("url");
- appender.setURLPkgPrefixes(null);
- appender.setSecurityPrincipalName("user");
- appender.setSecurityCredentials("cred");
-
- Properties props = appender.buildEnvProperties();
- assertEquals(4, props.size());
- assertEquals(appender.getInitialContextFactoryName(), props.getProperty(Context.INITIAL_CONTEXT_FACTORY));
- assertEquals(appender.getProviderURL(), props.getProperty(Context.PROVIDER_URL));
- assertEquals(null, props.getProperty(Context.URL_PKG_PREFIXES));
- assertEquals(appender.getSecurityPrincipalName(), props.getProperty(Context.SECURITY_PRINCIPAL));
- assertEquals(appender.getSecurityCredentials(), props.getProperty(Context.SECURITY_CREDENTIALS));
-
- assertEquals(0, context.getStatusManager().getCount());
- }
-
- @Test
- public void testStartMinimalInfo() {
- // let's leave only what's in the setup()
- // method, minus the providerURL
- appender.setProviderURL(null);
- appender.start();
-
- assertTrue(appender.isStarted());
-
- try {
- assertEquals(appender.topicBindingName, appender.topicPublisher.getTopic().getTopicName());
- } catch (Exception e) {
- fail();
- }
- }
-
- @Test
- public void testStartUserPass() {
- appender.setUserName("test");
- appender.setPassword("test");
-
- appender.start();
-
- assertTrue(appender.isStarted());
-
- try {
- assertEquals(appender.topicBindingName, appender.topicPublisher.getTopic().getTopicName());
- } catch (Exception e) {
- fail();
- }
- }
-
- @Test
- public void testStartFails() {
- appender.topicBindingName = null;
-
- appender.start();
-
- assertFalse(appender.isStarted());
- }
-
- private ILoggingEvent createLoggingEvent() {
- LoggingEvent le = new LoggingEvent();
- le.setLevel(Level.DEBUG);
- le.setMessage("test message");
- le.setTimeStamp(System.currentTimeMillis());
- le.setThreadName(Thread.currentThread().getName());
- return le;
- }
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockObjectMessage.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockObjectMessage.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockObjectMessage.java 2016-02-25 21:15:37.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockObjectMessage.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,237 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.ObjectMessage;
-
-public class MockObjectMessage implements ObjectMessage {
-
- Serializable object;
-
- public Serializable getObject() throws JMSException {
- return object;
- }
-
- public void setObject(Serializable object) throws JMSException {
- this.object = object;
- }
-
- public void acknowledge() throws JMSException {
-
- }
-
- public void clearBody() throws JMSException {
-
- }
-
- public void clearProperties() throws JMSException {
-
- }
-
- public boolean getBooleanProperty(String arg0) throws JMSException {
-
- return false;
- }
-
- public byte getByteProperty(String arg0) throws JMSException {
-
- return 0;
- }
-
- public double getDoubleProperty(String arg0) throws JMSException {
-
- return 0;
- }
-
- public float getFloatProperty(String arg0) throws JMSException {
-
- return 0;
- }
-
- public int getIntProperty(String arg0) throws JMSException {
-
- return 0;
- }
-
- public String getJMSCorrelationID() throws JMSException {
-
- return null;
- }
-
- public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
-
- return null;
- }
-
- public int getJMSDeliveryMode() throws JMSException {
-
- return 0;
- }
-
- public Destination getJMSDestination() throws JMSException {
-
- return null;
- }
-
- public long getJMSExpiration() throws JMSException {
-
- return 0;
- }
-
- public String getJMSMessageID() throws JMSException {
-
- return null;
- }
-
- public int getJMSPriority() throws JMSException {
-
- return 0;
- }
-
- public boolean getJMSRedelivered() throws JMSException {
-
- return false;
- }
-
- public Destination getJMSReplyTo() throws JMSException {
-
- return null;
- }
-
- public long getJMSTimestamp() throws JMSException {
-
- return 0;
- }
-
- public String getJMSType() throws JMSException {
-
- return null;
- }
-
- public long getLongProperty(String arg0) throws JMSException {
-
- return 0;
- }
-
- public Object getObjectProperty(String arg0) throws JMSException {
-
- return null;
- }
-
- public Enumeration getPropertyNames() throws JMSException {
-
- return null;
- }
-
- public short getShortProperty(String arg0) throws JMSException {
-
- return 0;
- }
-
- public String getStringProperty(String arg0) throws JMSException {
-
- return null;
- }
-
- public boolean propertyExists(String arg0) throws JMSException {
-
- return false;
- }
-
- public void setBooleanProperty(String arg0, boolean arg1) throws JMSException {
-
- }
-
- public void setByteProperty(String arg0, byte arg1) throws JMSException {
-
- }
-
- public void setDoubleProperty(String arg0, double arg1) throws JMSException {
-
- }
-
- public void setFloatProperty(String arg0, float arg1) throws JMSException {
-
- }
-
- public void setIntProperty(String arg0, int arg1) throws JMSException {
-
- }
-
- public void setJMSCorrelationID(String arg0) throws JMSException {
-
- }
-
- public void setJMSCorrelationIDAsBytes(byte[] arg0) throws JMSException {
-
- }
-
- public void setJMSDeliveryMode(int arg0) throws JMSException {
-
- }
-
- public void setJMSDestination(Destination arg0) throws JMSException {
-
- }
-
- public void setJMSExpiration(long arg0) throws JMSException {
-
- }
-
- public void setJMSMessageID(String arg0) throws JMSException {
-
- }
-
- public void setJMSPriority(int arg0) throws JMSException {
-
- }
-
- public void setJMSRedelivered(boolean arg0) throws JMSException {
-
- }
-
- public void setJMSReplyTo(Destination arg0) throws JMSException {
-
- }
-
- public void setJMSTimestamp(long arg0) throws JMSException {
-
- }
-
- public void setJMSType(String arg0) throws JMSException {
-
- }
-
- public void setLongProperty(String arg0, long arg1) throws JMSException {
-
- }
-
- public void setObjectProperty(String arg0, Object arg1) throws JMSException {
-
- }
-
- public void setShortProperty(String arg0, short arg1) throws JMSException {
-
- }
-
- public void setStringProperty(String arg0, String arg1) throws JMSException {
-
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnectionFactory.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,42 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-
-public class MockQueueConnectionFactory implements QueueConnectionFactory {
-
- MockQueueConnection cnx = new MockQueueConnection();
-
- public QueueConnection createQueueConnection() throws JMSException {
- return cnx;
- }
-
- public QueueConnection createQueueConnection(String user, String pass) throws JMSException {
-
- return cnx;
- }
-
- public Connection createConnection() throws JMSException {
- return null;
- }
-
- public Connection createConnection(String arg0, String arg1) throws JMSException {
- return null;
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java 2016-02-25 21:15:40.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueConnection.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,91 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import javax.jms.ConnectionConsumer;
-import javax.jms.ConnectionMetaData;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueSession;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.Topic;
-
-public class MockQueueConnection implements QueueConnection {
-
- MockQueueSession session = new MockQueueSession();
-
- public QueueSession createQueueSession(boolean arg0, int arg1) throws JMSException {
- return session;
- }
-
- public ConnectionConsumer createConnectionConsumer(Queue arg0, String arg1, ServerSessionPool arg2, int arg3) throws JMSException {
-
- return null;
- }
-
- public void close() throws JMSException {
-
- }
-
- public ConnectionConsumer createConnectionConsumer(Destination arg0, String arg1, ServerSessionPool arg2, int arg3) throws JMSException {
-
- return null;
- }
-
- public ConnectionConsumer createDurableConnectionConsumer(Topic arg0, String arg1, String arg2, ServerSessionPool arg3, int arg4) throws JMSException {
-
- return null;
- }
-
- public Session createSession(boolean arg0, int arg1) throws JMSException {
-
- return null;
- }
-
- public String getClientID() throws JMSException {
-
- return null;
- }
-
- public ExceptionListener getExceptionListener() throws JMSException {
-
- return null;
- }
-
- public ConnectionMetaData getMetaData() throws JMSException {
-
- return null;
- }
-
- public void setClientID(String arg0) throws JMSException {
-
- }
-
- public void setExceptionListener(ExceptionListener arg0) throws JMSException {
-
- }
-
- public void start() throws JMSException {
-
- }
-
- public void stop() throws JMSException {
-
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java 2016-02-25 21:15:40.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueue.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,31 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import javax.jms.JMSException;
-import javax.jms.Queue;
-
-public class MockQueue implements Queue {
-
- String name;
-
- public MockQueue(String name) {
- this.name = name;
- }
-
- public String getQueueName() throws JMSException {
- return name;
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSender.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,121 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Queue;
-import javax.jms.QueueSender;
-
-public class MockQueueSender implements QueueSender {
-
- List messageList = new ArrayList();
- Queue queue;
-
- public MockQueueSender(Queue queue) {
- this.queue = queue;
- }
-
- public List getMessageList() {
- return messageList;
- }
-
- public Queue getQueue() throws JMSException {
- return queue;
- }
-
- public void send(Message message) throws JMSException {
- messageList.add(message);
-
- }
-
- public void send(Queue arg0, Message arg1) throws JMSException {
-
- }
-
- public void send(Message arg0, int arg1, int arg2, long arg3) throws JMSException {
-
- }
-
- public void send(Queue arg0, Message arg1, int arg2, int arg3, long arg4) throws JMSException {
-
- }
-
- public void close() throws JMSException {
-
- }
-
- public int getDeliveryMode() throws JMSException {
-
- return 0;
- }
-
- public Destination getDestination() throws JMSException {
-
- return null;
- }
-
- public boolean getDisableMessageID() throws JMSException {
-
- return false;
- }
-
- public boolean getDisableMessageTimestamp() throws JMSException {
-
- return false;
- }
-
- public int getPriority() throws JMSException {
-
- return 0;
- }
-
- public long getTimeToLive() throws JMSException {
-
- return 0;
- }
-
- public void send(Destination arg0, Message arg1) throws JMSException {
-
- }
-
- public void send(Destination arg0, Message arg1, int arg2, int arg3, long arg4) throws JMSException {
-
- }
-
- public void setDeliveryMode(int arg0) throws JMSException {
-
- }
-
- public void setDisableMessageID(boolean arg0) throws JMSException {
-
- }
-
- public void setDisableMessageTimestamp(boolean arg0) throws JMSException {
-
- }
-
- public void setPriority(int arg0) throws JMSException {
-
- }
-
- public void setTimeToLive(long arg0) throws JMSException {
-
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockQueueSession.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,200 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import java.io.Serializable;
-
-import javax.jms.BytesMessage;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
-import javax.jms.QueueReceiver;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.StreamMessage;
-import javax.jms.TemporaryQueue;
-import javax.jms.TemporaryTopic;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicSubscriber;
-
-public class MockQueueSession implements QueueSession {
-
- public ObjectMessage createObjectMessage() throws JMSException {
- return new MockObjectMessage();
- }
-
- public QueueSender createSender(Queue queue) throws JMSException {
- if (queue == null) {
- return null;
- }
- return new MockQueueSender(queue);
- }
-
- public QueueBrowser createBrowser(Queue arg0) throws JMSException {
-
- return null;
- }
-
- public QueueBrowser createBrowser(Queue arg0, String arg1) throws JMSException {
-
- return null;
- }
-
- public Queue createQueue(String arg0) throws JMSException {
-
- return null;
- }
-
- public QueueReceiver createReceiver(Queue arg0) throws JMSException {
-
- return null;
- }
-
- public QueueReceiver createReceiver(Queue arg0, String arg1) throws JMSException {
-
- return null;
- }
-
- public TemporaryQueue createTemporaryQueue() throws JMSException {
-
- return null;
- }
-
- public void close() throws JMSException {
-
- }
-
- public void commit() throws JMSException {
-
- }
-
- public BytesMessage createBytesMessage() throws JMSException {
-
- return null;
- }
-
- public MessageConsumer createConsumer(Destination arg0) throws JMSException {
-
- return null;
- }
-
- public MessageConsumer createConsumer(Destination arg0, String arg1) throws JMSException {
-
- return null;
- }
-
- public MessageConsumer createConsumer(Destination arg0, String arg1, boolean arg2) throws JMSException {
-
- return null;
- }
-
- public TopicSubscriber createDurableSubscriber(Topic arg0, String arg1) throws JMSException {
-
- return null;
- }
-
- public TopicSubscriber createDurableSubscriber(Topic arg0, String arg1, String arg2, boolean arg3) throws JMSException {
-
- return null;
- }
-
- public MapMessage createMapMessage() throws JMSException {
-
- return null;
- }
-
- public Message createMessage() throws JMSException {
-
- return null;
- }
-
- public ObjectMessage createObjectMessage(Serializable arg0) throws JMSException {
-
- return null;
- }
-
- public MessageProducer createProducer(Destination arg0) throws JMSException {
-
- return null;
- }
-
- public StreamMessage createStreamMessage() throws JMSException {
-
- return null;
- }
-
- public TemporaryTopic createTemporaryTopic() throws JMSException {
-
- return null;
- }
-
- public TextMessage createTextMessage() throws JMSException {
-
- return null;
- }
-
- public TextMessage createTextMessage(String arg0) throws JMSException {
-
- return null;
- }
-
- public Topic createTopic(String arg0) throws JMSException {
-
- return null;
- }
-
- public int getAcknowledgeMode() throws JMSException {
-
- return 0;
- }
-
- public MessageListener getMessageListener() throws JMSException {
-
- return null;
- }
-
- public boolean getTransacted() throws JMSException {
-
- return false;
- }
-
- public void recover() throws JMSException {
-
- }
-
- public void rollback() throws JMSException {
-
- }
-
- public void run() {
-
- }
-
- public void setMessageListener(MessageListener arg0) throws JMSException {
-
- }
-
- public void unsubscribe(String arg0) throws JMSException {
-
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnectionFactory.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnectionFactory.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnectionFactory.java 2016-02-25 21:15:37.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnectionFactory.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,42 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-
-public class MockTopicConnectionFactory implements TopicConnectionFactory {
-
- MockTopicConnection cnx = new MockTopicConnection();
-
- public TopicConnection createTopicConnection() throws JMSException {
- return cnx;
- }
-
- public TopicConnection createTopicConnection(String user, String pass) throws JMSException {
-
- return cnx;
- }
-
- public Connection createConnection() throws JMSException {
- return null;
- }
-
- public Connection createConnection(String arg0, String arg1) throws JMSException {
- return null;
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnection.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnection.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnection.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicConnection.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,90 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import javax.jms.ConnectionConsumer;
-import javax.jms.ConnectionMetaData;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.ServerSessionPool;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicSession;
-
-public class MockTopicConnection implements TopicConnection {
-
- MockTopicSession session = new MockTopicSession();
-
- public TopicSession createTopicSession(boolean arg0, int arg1) throws JMSException {
- return session;
- }
-
- public ConnectionConsumer createConnectionConsumer(Topic arg0, String arg1, ServerSessionPool arg2, int arg3) throws JMSException {
-
- return null;
- }
-
- public ConnectionConsumer createDurableConnectionConsumer(Topic arg0, String arg1, String arg2, ServerSessionPool arg3, int arg4) throws JMSException {
-
- return null;
- }
-
- public void close() throws JMSException {
-
- }
-
- public ConnectionConsumer createConnectionConsumer(Destination arg0, String arg1, ServerSessionPool arg2, int arg3) throws JMSException {
-
- return null;
- }
-
- public Session createSession(boolean arg0, int arg1) throws JMSException {
-
- return null;
- }
-
- public String getClientID() throws JMSException {
-
- return null;
- }
-
- public ExceptionListener getExceptionListener() throws JMSException {
-
- return null;
- }
-
- public ConnectionMetaData getMetaData() throws JMSException {
-
- return null;
- }
-
- public void setClientID(String arg0) throws JMSException {
-
- }
-
- public void setExceptionListener(ExceptionListener arg0) throws JMSException {
-
- }
-
- public void start() throws JMSException {
-
- }
-
- public void stop() throws JMSException {
-
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopic.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopic.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopic.java 2016-02-25 21:15:37.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopic.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,31 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import javax.jms.JMSException;
-import javax.jms.Topic;
-
-public class MockTopic implements Topic {
-
- String name;
-
- public MockTopic(String name) {
- this.name = name;
- }
-
- public String getTopicName() throws JMSException {
- return name;
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicPublisher.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicPublisher.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicPublisher.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicPublisher.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,128 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Topic;
-import javax.jms.TopicPublisher;
-
-public class MockTopicPublisher implements TopicPublisher {
-
- List messageList = new ArrayList();
- Topic topic;
-
- public MockTopicPublisher(Topic topic) {
- this.topic = topic;
- }
-
- public void publish(Message message) throws JMSException {
- messageList.add(message);
- }
-
- public List getMessageList() {
- return messageList;
- }
-
- public Topic getTopic() throws JMSException {
- return topic;
- }
-
- public void publish(Message arg0, int arg1, int arg2, long arg3) throws JMSException {
-
- }
-
- public void publish(Topic arg0, Message arg1, int arg2, int arg3, long arg4) throws JMSException {
-
- }
-
- public void publish(Topic arg0, Message arg1) throws JMSException {
-
- }
-
- public void close() throws JMSException {
-
- }
-
- public int getDeliveryMode() throws JMSException {
-
- return 0;
- }
-
- public Destination getDestination() throws JMSException {
-
- return null;
- }
-
- public boolean getDisableMessageID() throws JMSException {
-
- return false;
- }
-
- public boolean getDisableMessageTimestamp() throws JMSException {
-
- return false;
- }
-
- public int getPriority() throws JMSException {
-
- return 0;
- }
-
- public long getTimeToLive() throws JMSException {
-
- return 0;
- }
-
- public void send(Destination arg0, Message arg1, int arg2, int arg3, long arg4) throws JMSException {
-
- }
-
- public void send(Destination arg0, Message arg1) throws JMSException {
-
- }
-
- public void send(Message arg0, int arg1, int arg2, long arg3) throws JMSException {
-
- }
-
- public void send(Message arg0) throws JMSException {
-
- }
-
- public void setDeliveryMode(int arg0) throws JMSException {
-
- }
-
- public void setDisableMessageID(boolean arg0) throws JMSException {
-
- }
-
- public void setDisableMessageTimestamp(boolean arg0) throws JMSException {
-
- }
-
- public void setPriority(int arg0) throws JMSException {
-
- }
-
- public void setTimeToLive(long arg0) throws JMSException {
-
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicSession.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicSession.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicSession.java 2016-02-25 21:15:37.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockTopicSession.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,193 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.mock;
-
-import java.io.Serializable;
-
-import javax.jms.BytesMessage;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.QueueBrowser;
-import javax.jms.StreamMessage;
-import javax.jms.TemporaryQueue;
-import javax.jms.TemporaryTopic;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-
-public class MockTopicSession implements TopicSession {
-
- public ObjectMessage createObjectMessage() throws JMSException {
- return new MockObjectMessage();
- }
-
- public TopicPublisher createPublisher(Topic topic) throws JMSException {
- if (topic == null) {
- return null;
- }
- return new MockTopicPublisher(topic);
- }
-
- public TopicSubscriber createDurableSubscriber(Topic arg0, String arg1) throws JMSException {
- return null;
- }
-
- public TopicSubscriber createDurableSubscriber(Topic arg0, String arg1, String arg2, boolean arg3) throws JMSException {
- return null;
- }
-
- public TopicSubscriber createSubscriber(Topic arg0) throws JMSException {
- return null;
- }
-
- public TopicSubscriber createSubscriber(Topic arg0, String arg1, boolean arg2) throws JMSException {
- return null;
- }
-
- public TemporaryTopic createTemporaryTopic() throws JMSException {
- return null;
- }
-
- public Topic createTopic(String arg0) throws JMSException {
- return null;
- }
-
- public void unsubscribe(String arg0) throws JMSException {
-
- }
-
- public void close() throws JMSException {
-
- }
-
- public void commit() throws JMSException {
-
- }
-
- public QueueBrowser createBrowser(Queue arg0) throws JMSException {
-
- return null;
- }
-
- public QueueBrowser createBrowser(Queue arg0, String arg1) throws JMSException {
-
- return null;
- }
-
- public BytesMessage createBytesMessage() throws JMSException {
-
- return null;
- }
-
- public MessageConsumer createConsumer(Destination arg0) throws JMSException {
-
- return null;
- }
-
- public MessageConsumer createConsumer(Destination arg0, String arg1) throws JMSException {
-
- return null;
- }
-
- public MessageConsumer createConsumer(Destination arg0, String arg1, boolean arg2) throws JMSException {
-
- return null;
- }
-
- public MapMessage createMapMessage() throws JMSException {
-
- return null;
- }
-
- public Message createMessage() throws JMSException {
-
- return null;
- }
-
- public ObjectMessage createObjectMessage(Serializable arg0) throws JMSException {
-
- return null;
- }
-
- public MessageProducer createProducer(Destination arg0) throws JMSException {
-
- return null;
- }
-
- public Queue createQueue(String arg0) throws JMSException {
-
- return null;
- }
-
- public StreamMessage createStreamMessage() throws JMSException {
-
- return null;
- }
-
- public TemporaryQueue createTemporaryQueue() throws JMSException {
-
- return null;
- }
-
- public TextMessage createTextMessage() throws JMSException {
-
- return null;
- }
-
- public TextMessage createTextMessage(String arg0) throws JMSException {
-
- return null;
- }
-
- public int getAcknowledgeMode() throws JMSException {
-
- return 0;
- }
-
- public MessageListener getMessageListener() throws JMSException {
-
- return null;
- }
-
- public boolean getTransacted() throws JMSException {
-
- return false;
- }
-
- public void recover() throws JMSException {
-
- }
-
- public void rollback() throws JMSException {
-
- }
-
- public void run() {
-
- }
-
- public void setMessageListener(MessageListener arg0) throws JMSException {
-
- }
-
-}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/PackageTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -18,7 +18,7 @@
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({ SyslogAppenderTest.class, DilutedSMTPAppenderTest.class, JMSQueueAppenderTest.class, JMSTopicAppenderTest.class, SMTPAppender_GreenTest.class,
+@SuiteClasses({ SyslogAppenderTest.class, DilutedSMTPAppenderTest.class, SMTPAppender_GreenTest.class,
SMTPAppender_SubethaSMTPTest.class, SocketReceiverTest.class, SSLSocketReceiverTest.class })
public class PackageTest {
}
\ No newline at end of file
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderMessageLossTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderMessageLossTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderMessageLossTest.java 2016-03-03 16:19:05.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderMessageLossTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -13,28 +13,28 @@
*/
package ch.qos.logback.classic.net;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+import org.junit.Test;
+
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;
import ch.qos.logback.core.testUtil.RandomUtil;
import ch.qos.logback.core.util.Duration;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
public class SocketAppenderMessageLossTest {
int runLen = 100;
Duration reconnectionDelay = new Duration(1000);
static final int TIMEOUT = 3000;
-
- @Test(timeout = TIMEOUT)
+
+ @Test // (timeout = TIMEOUT)
public void synchronousSocketAppender() throws Exception {
SocketAppender socketAppender = new SocketAppender();
@@ -90,9 +90,9 @@
listAppender.setContext(serverLoggerContext);
listAppender.start();
- Logger serverLogger = serverLoggerContext.getLogger(getClass());
- serverLogger.setAdditive(false);
- serverLogger.addAppender(listAppender);
+ Logger serverRootLogger = serverLoggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
+ serverRootLogger.setAdditive(false);
+ serverRootLogger.addAppender(listAppender);
LoggerContext loggerContext = new LoggerContext();
loggerContext.setName("clientLoggerContext");
@@ -120,9 +120,9 @@
}
allMessagesReceivedLatch.await();
-
- assertEquals(runLen, listAppender.list.size());
loggerContext.stop();
simpleSocketServer.close();
+
+
}
}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -40,12 +40,14 @@
Logger logger = lc.getLogger(ConverterTest.class);
Logger root = lc.getLogger(Logger.ROOT_LOGGER_NAME);
+ String aMessage = "Some message";
+
ILoggingEvent le;
public PatternLayoutTest() {
super();
Exception ex = new Exception("Bogus exception");
- le = makeLoggingEvent(ex);
+ le = makeLoggingEvent(aMessage, ex);
}
@Before
@@ -53,16 +55,16 @@
pl.setContext(lc);
}
- ILoggingEvent makeLoggingEvent(Exception ex) {
- return new LoggingEvent(ch.qos.logback.core.pattern.FormattingConverter.class.getName(), logger, Level.INFO, "Some message", ex, null);
+ ILoggingEvent makeLoggingEvent(String msg, Exception ex) {
+ return new LoggingEvent(ch.qos.logback.core.pattern.FormattingConverter.class.getName(), logger, Level.INFO, msg, ex, null);
}
- @Override
+
public ILoggingEvent getEventObject() {
- return makeLoggingEvent(null);
+ return makeLoggingEvent("Some message", null);
}
- public PatternLayoutBase getPatternLayoutBase() {
+ public PatternLayoutBase getPatternLayoutBase() {
return new PatternLayout();
}
@@ -119,9 +121,8 @@
public void testWithParenthesis() {
pl.setPattern("\\(%msg:%msg\\) %msg");
pl.start();
- le = makeLoggingEvent(null);
+ le = makeLoggingEvent(aMessage, null);
String val = pl.doLayout(le);
- // System.out.println("VAL == " + val);
assertEquals("(Some message:Some message) Some message", val);
}
@@ -193,7 +194,7 @@
}
@Test
- public void somekeReplace() {
+ public void smokeReplace() {
pl.setPattern("%replace(a1234b){'\\d{4}', 'XXXX'}");
pl.start();
StatusPrinter.print(lc);
@@ -202,6 +203,18 @@
}
@Test
+ public void replaceNewline() {
+ String pattern = "%replace(A\nB){'\n', '\n\t'}";
+ String substPattern = OptionHelper.substVars(pattern, null, lc);
+ assertEquals(pattern, substPattern);
+ pl.setPattern(substPattern);
+ pl.start();
+ StatusPrinter.print(lc);
+ String val = pl.doLayout(makeLoggingEvent("", null));
+ assertEquals("A\n\tB", val);
+ }
+
+ @Test
public void replaceWithJoran() throws JoranException {
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "pattern/replace0.xml");
StatusPrinter.print(lc);
@@ -214,4 +227,17 @@
assertEquals("And the number is XXXX, expiring on 12/2010", sla.strList.get(0));
}
+ @Test
+ public void replaceWithJoran_NEWLINE() throws JoranException {
+ lc.putProperty("TAB", "\t");
+ configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "pattern/replaceNewline.xml");
+ StatusPrinter.print(lc);
+ root.getAppender("LIST");
+ String msg = "A\nC";
+ logger.debug(msg);
+ StringListAppender sla = (StringListAppender) root.getAppender("LIST");
+ assertNotNull(sla);
+ assertEquals(1, sla.strList.size());
+ assertEquals("A\n\tC", sla.strList.get(0));
+ }
}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializerTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializerTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializerTest.java 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/servlet/LogbackServletContainerInitializerTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,43 @@
+package ch.qos.logback.classic.servlet;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import ch.qos.logback.core.CoreConstants;
+
+import static org.mockito.Mockito.*;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+public class LogbackServletContainerInitializerTest {
+
+ LogbackServletContainerInitializer lsci = new LogbackServletContainerInitializer();
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testOnStartup() throws ServletException {
+ ServletContext mockedServletContext = mock(ServletContext.class);
+ lsci.onStartup(null, mockedServletContext);
+ verify(mockedServletContext).addListener(any(LogbackServletContextListener.class));
+ }
+
+ @Test
+ public void noListenerShouldBeAddedWhenDisabled() throws ServletException {
+ ServletContext mockedServletContext = mock(ServletContext.class);
+ when(mockedServletContext.getInitParameter(CoreConstants.DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY)).thenReturn("true");
+ lsci.onStartup(null, mockedServletContext);
+ verify(mockedServletContext, times(0)).addListener(any(LogbackServletContextListener.class));
+ }
+
+}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java 2016-02-25 21:15:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -34,11 +34,12 @@
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.net.LoggingEventPreSerializationTransformer;
+import ch.qos.logback.classic.net.server.HardenedLoggingEventInputStream;
import ch.qos.logback.core.spi.PreSerializationTransformer;
public class LoggingEventSerializationTest {
- LoggerContext lc;
+ LoggerContext loggerContext;
Logger logger;
ByteArrayOutputStream bos;
@@ -48,9 +49,9 @@
@Before
public void setUp() throws Exception {
- lc = new LoggerContext();
- lc.setName("testContext");
- logger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
+ loggerContext = new LoggerContext();
+ loggerContext.setName("testContext");
+ logger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
// create the byte output stream
bos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bos);
@@ -58,7 +59,7 @@
@After
public void tearDown() throws Exception {
- lc = null;
+ loggerContext = null;
logger = null;
oos.close();
}
@@ -72,7 +73,7 @@
@Test
public void context() throws Exception {
- lc.putProperty("testKey", "testValue");
+ loggerContext.putProperty("testKey", "testValue");
ILoggingEvent event = createLoggingEvent();
ILoggingEvent remoteEvent = writeAndRead(event);
checkForEquality(event, remoteEvent);
@@ -140,11 +141,17 @@
}
@Test
- public void _Throwable() throws Exception {
- LoggingEvent event = createLoggingEvent();
+ public void testWithThrowable() throws Exception {
Throwable throwable = new Throwable("just testing");
- ThrowableProxy tp = new ThrowableProxy(throwable);
- event.setThrowableProxy(tp);
+ LoggingEvent event = createLoggingEventWithThrowable(throwable);
+ ILoggingEvent remoteEvent = writeAndRead(event);
+ checkForEquality(event, remoteEvent);
+ }
+
+ @Test
+ public void testWithCallerData() throws Exception {
+ LoggingEvent event = createLoggingEvent();
+ event.getCallerData();
ILoggingEvent remoteEvent = writeAndRead(event);
checkForEquality(event, remoteEvent);
}
@@ -187,6 +194,10 @@
return new LoggingEvent(this.getClass().getName(), logger, Level.DEBUG, "test message", null, null);
}
+ private LoggingEvent createLoggingEventWithThrowable(Throwable t) {
+ return new LoggingEvent(this.getClass().getName(), logger, Level.DEBUG, "test message", t, null);
+ }
+
private void checkForEquality(ILoggingEvent original, ILoggingEvent afterSerialization) {
assertEquals(original.getLevel(), afterSerialization.getLevel());
assertEquals(original.getFormattedMessage(), afterSerialization.getFormattedMessage());
@@ -203,8 +214,8 @@
Serializable ser = pst.transform(event);
oos.writeObject(ser);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
- inputStream = new ObjectInputStream(bis);
-
+ inputStream = new HardenedLoggingEventInputStream(bis);
+
return (ILoggingEvent) inputStream.readObject();
}
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerAutoConfigTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerAutoConfigTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerAutoConfigTest.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerAutoConfigTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -42,7 +42,7 @@
@After
public void tearDown() throws Exception {
System.clearProperty(ContextInitializer.CONFIG_FILE_PROPERTY);
- System.clearProperty(CoreConstants.STATUS_LISTENER_CLASS);
+ System.clearProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY);
}
@Test
diff -Nru logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java
--- logback-1.1.9/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java 2016-02-25 21:15:39.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/ch/qos/logback/classic/util/ContextInitializerTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -59,7 +59,7 @@
@After
public void tearDown() throws Exception {
System.clearProperty(ContextInitializer.CONFIG_FILE_PROPERTY);
- System.clearProperty(CoreConstants.STATUS_LISTENER_CLASS);
+ System.clearProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY);
MockConfigurator.context = null;
}
@@ -119,7 +119,7 @@
@Test
public void autoStatusListener() throws JoranException {
- System.setProperty(CoreConstants.STATUS_LISTENER_CLASS, TrivialStatusListener.class.getName());
+ System.setProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY, TrivialStatusListener.class.getName());
List statusListenerList = loggerContext.getStatusManager().getCopyOfStatusListenerList();
assertEquals(0, statusListenerList.size());
doAutoConfigFromSystemProperties(ClassicTestConstants.INPUT_PREFIX + "autoConfig.xml");
@@ -132,7 +132,7 @@
@Test
public void autoOnConsoleStatusListener() throws JoranException {
- System.setProperty(CoreConstants.STATUS_LISTENER_CLASS, CoreConstants.SYSOUT);
+ System.setProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY, CoreConstants.SYSOUT);
List sll = loggerContext.getStatusManager().getCopyOfStatusListenerList();
assertEquals(0, sll.size());
doAutoConfigFromSystemProperties(ClassicTestConstants.INPUT_PREFIX + "autoConfig.xml");
diff -Nru logback-1.1.9/logback-classic/src/test/java/org/slf4j/impl/InitializationOutputTest.java logback-1.2.3/logback-classic/src/test/java/org/slf4j/impl/InitializationOutputTest.java
--- logback-1.1.9/logback-classic/src/test/java/org/slf4j/impl/InitializationOutputTest.java 2016-11-08 07:33:38.000000000 +0000
+++ logback-1.2.3/logback-classic/src/test/java/org/slf4j/impl/InitializationOutputTest.java 2017-03-30 02:48:10.000000000 +0000
@@ -56,13 +56,13 @@
public void tearDown() {
System.setOut(original);
System.clearProperty(ContextInitializer.CONFIG_FILE_PROPERTY);
- System.clearProperty(CoreConstants.STATUS_LISTENER_CLASS);
+ System.clearProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY);
}
@Test
public void noOutputIfContextHasAStatusListener() {
System.setProperty(ContextInitializer.CONFIG_FILE_PROPERTY, ClassicTestConstants.INPUT_PREFIX + "issue/logback292.xml");
- System.setProperty(CoreConstants.STATUS_LISTENER_CLASS, NopStatusListener.class.getName());
+ System.setProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY, NopStatusListener.class.getName());
StaticLoggerBinderFriend.reset();
assertEquals(0, tee.baos.size());
diff -Nru logback-1.1.9/logback-core/pom.xml logback-1.2.3/logback-core/pom.xml
--- logback-1.1.9/logback-core/pom.xml 2017-01-20 18:37:25.000000000 +0000
+++ logback-1.2.3/logback-core/pom.xml 2017-04-01 03:15:20.000000000 +0000
@@ -1,3 +1,4 @@
+
@@ -7,7 +8,7 @@
ch.qos.logbacklogback-parent
- 1.1.9
+ 1.2.3logback-core
@@ -25,7 +26,7 @@
org.fusesource.jansijansi
- true
+ truejavax.mail
@@ -34,20 +35,13 @@
true
- org.apache.geronimo.specs
- geronimo-jms_1.1_spec
- compile
- true
-
- org.mockitomockito-core
- 1.9.5testjavax.servlet
- servlet-api
+ javax.servlet-apicompiletrue
@@ -84,8 +78,7 @@
maven-jar-plugin
- ${project.build.outputDirectory}/META-INF/MANIFEST.MF
-
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java 2016-03-03 11:51:31.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java 2017-03-30 02:48:10.000000000 +0000
@@ -15,6 +15,7 @@
import ch.qos.logback.core.spi.AppenderAttachable;
import ch.qos.logback.core.spi.AppenderAttachableImpl;
+import ch.qos.logback.core.util.InterruptUtil;
import java.util.Iterator;
import java.util.concurrent.ArrayBlockingQueue;
@@ -123,7 +124,12 @@
// interrupt the worker thread so that it can terminate. Note that the interruption can be consumed
// by sub-appenders
worker.interrupt();
+
+ InterruptUtil interruptUtil = new InterruptUtil(context);
+
try {
+ interruptUtil.maskInterruptFlag();
+
worker.join(maxFlushTime);
// check to see if the thread ended and if not add a warning message
@@ -135,10 +141,17 @@
}
} catch (InterruptedException e) {
- addError("Failed to join worker thread. " + blockingQueue.size() + " queued events may be discarded.", e);
+ int remaining = blockingQueue.size();
+ addError("Failed to join worker thread. " + remaining + " queued events may be discarded.", e);
+ } finally {
+ interruptUtil.unmaskInterruptFlag();
}
}
+
+
+
+
@Override
protected void append(E eventObject) {
if (isQueueBelowDiscardingThreshold() && isDiscardable(eventObject)) {
@@ -156,11 +169,23 @@
if (neverBlock) {
blockingQueue.offer(eventObject);
} else {
- try {
- blockingQueue.put(eventObject);
- } catch (InterruptedException e) {
- // Interruption of current thread when in doAppend method should not be consumed
- // by AsyncAppender
+ putUninterruptibly(eventObject);
+ }
+ }
+
+ private void putUninterruptibly(E eventObject) {
+ boolean interrupted = false;
+ try {
+ while (true) {
+ try {
+ blockingQueue.put(eventObject);
+ break;
+ } catch (InterruptedException e) {
+ interrupted = true;
+ }
+ }
+ } finally {
+ if (interrupted) {
Thread.currentThread().interrupt();
}
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java 2017-01-20 11:08:01.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java 2017-03-30 02:48:10.000000000 +0000
@@ -14,6 +14,7 @@
package ch.qos.logback.core;
import static ch.qos.logback.core.CoreConstants.CONTEXT_NAME_KEY;
+import static ch.qos.logback.core.CoreConstants.HOSTNAME_KEY;
import static ch.qos.logback.core.CoreConstants.FA_FILENAME_COLLISION_MAP;
import static ch.qos.logback.core.CoreConstants.RFA_FILENAME_PATTERN_COLLISION_MAP;
@@ -29,6 +30,7 @@
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.ContextUtil;
import ch.qos.logback.core.util.ExecutorServiceUtil;
public class ContextBase implements Context, LifeCycle {
@@ -81,7 +83,11 @@
}
public void putProperty(String key, String val) {
- this.propertyMap.put(key, val);
+ if (HOSTNAME_KEY.equalsIgnoreCase(key)) {
+ putHostnameProperty(val);
+ } else {
+ this.propertyMap.put(key, val);
+ }
}
protected void initCollisionMaps() {
@@ -99,10 +105,31 @@
public String getProperty(String key) {
if (CONTEXT_NAME_KEY.equals(key))
return getName();
+ if (HOSTNAME_KEY.equalsIgnoreCase(key)) {
+ return lazyGetHostname();
+ }
return (String) this.propertyMap.get(key);
}
+ private String lazyGetHostname() {
+ String hostname = (String) this.propertyMap.get(HOSTNAME_KEY);
+ if (hostname == null) {
+ hostname = new ContextUtil(this).safelyGetLocalHostName();
+ putHostnameProperty(hostname);
+ }
+ return hostname;
+ }
+
+ private void putHostnameProperty(String hostname) {
+ String existingHostname = (String) this.propertyMap.get(HOSTNAME_KEY);
+ if (existingHostname == null) {
+ this.propertyMap.put(CoreConstants.HOSTNAME_KEY, hostname);
+ } else {
+
+ }
+ }
+
public Object getObject(String key) {
return objectMap.get(key);
}
@@ -130,7 +157,7 @@
// We don't check "started" here, because the executor service uses
// lazy initialization, rather than being created in the start method
stopExecutorService();
-
+
started = false;
}
@@ -143,7 +170,7 @@
* shutdown hook
*/
public void reset() {
-
+
removeShutdownHook();
getLifeCycleManager().reset();
propertyMap.clear();
@@ -248,7 +275,5 @@
public List> getScheduledFutures() {
return new ArrayList>(scheduledFutures);
}
-
-
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java 2017-01-20 18:21:19.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java 2017-03-30 02:48:10.000000000 +0000
@@ -16,7 +16,8 @@
public class CoreConstants {
- final public static String STATUS_LISTENER_CLASS = "logback.statusListenerClass";
+ final public static String DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY = "logbackDisableServletContainerInitializer";
+ final public static String STATUS_LISTENER_CLASS_KEY = "logback.statusListenerClass";
final public static String SYSOUT = "SYSOUT";
/**
@@ -167,6 +168,8 @@
*/
public static final String HOSTNAME_KEY = "HOSTNAME";
+ public static final String UNKNOWN_LOCALHOST = "UNKNOWN_LOCALHOST";
+
/**
* The key under which the current context name is registered in the logger
* context.
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java 2016-02-25 21:15:15.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java 2017-03-30 02:48:10.000000000 +0000
@@ -13,9 +13,6 @@
*/
package ch.qos.logback.core.encoder;
-import java.io.IOException;
-import java.io.OutputStream;
-
import ch.qos.logback.core.CoreConstants;
public class EchoEncoder extends EncoderBase {
@@ -23,25 +20,22 @@
String fileHeader;
String fileFooter;
- public void doEncode(E event) throws IOException {
+ public byte[] encode(E event) {
String val = event + CoreConstants.LINE_SEPARATOR;
- outputStream.write(val.getBytes());
- // necessary if ResilientFileOutputStream is buffered
- outputStream.flush();
+ return val.getBytes();
}
- public void close() throws IOException {
+ public byte[] footerBytes() {
if (fileFooter == null) {
- return;
+ return null;
}
- outputStream.write(fileFooter.getBytes());
+ return fileFooter.getBytes();
}
- public void init(OutputStream os) throws IOException {
- super.init(os);
+ public byte[] headerBytes() {
if (fileHeader == null) {
- return;
+ return null;
}
- outputStream.write(fileHeader.getBytes());
+ return fileHeader.getBytes();
}
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java 2016-02-25 21:15:16.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/EncoderBase.java 2017-03-30 02:48:10.000000000 +0000
@@ -13,21 +13,12 @@
*/
package ch.qos.logback.core.encoder;
-import java.io.IOException;
-import java.io.OutputStream;
-
import ch.qos.logback.core.spi.ContextAwareBase;
abstract public class EncoderBase extends ContextAwareBase implements Encoder {
protected boolean started;
- protected OutputStream outputStream;
-
- public void init(OutputStream os) throws IOException {
- this.outputStream = os;
- }
-
public boolean isStarted() {
return started;
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java 2016-11-08 07:33:38.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/Encoder.java 2017-03-30 02:48:10.000000000 +0000
@@ -13,18 +13,11 @@
*/
package ch.qos.logback.core.encoder;
-import java.io.IOException;
-import java.io.OutputStream;
-
import ch.qos.logback.core.spi.ContextAware;
import ch.qos.logback.core.spi.LifeCycle;
/**
* Encoders are responsible for transform an incoming event into a byte array
- * *and* writing out the byte array onto the appropriate {@link OutputStream}.
- * Thus, encoders have total control of what and when gets written to the
- * {@link OutputStream} maintained by the owning appender.
- *
*
* @author Ceki Gülcü
* @author Joern Huxhorn
@@ -37,32 +30,25 @@
public interface Encoder extends ContextAware, LifeCycle {
/**
- * This method is called when the owning appender starts or whenever output
- * needs to be directed to a new OutputStream, for instance as a result of a
- * rollover. Implementing encoders should at the very least remember the
- * OutputStream passed as argument and use it in future operations.
+ * Get header bytes. This method is typically called upon opening of
+ * an output stream.
*
- * @param os
- * @throws IOException
+ * @return header bytes. Null values are allowed.
*/
- void init(OutputStream os) throws IOException;
+ byte[] headerBytes();
/**
- * Encode and write an event to the appropriate {@link OutputStream}.
- * Implementations are free to differ writing out of the encoded event and
- * instead write in batches.
- *
+ * Encode an event as bytes.
+ *
* @param event
- * @throws IOException
*/
- void doEncode(E event) throws IOException;
-
+ byte[] encode(E event);
+
/**
- * This method is called prior to the closing of the underling
- * {@link OutputStream}. Implementations MUST not close the underlying
- * {@link OutputStream} which is the responsibility of the owning appender.
+ * Get footer bytes. This method is typically called prior to the closing
+ * of the stream where events are written.
*
- * @throws IOException
+ * @return footer bytes. Null values are allowed.
*/
- void close() throws IOException;
+ byte[] footerBytes();
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java 2016-02-25 21:15:17.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/EventObjectInputStream.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,156 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.encoder;
-
-import static ch.qos.logback.core.CoreConstants.BYTES_PER_INT;
-import static ch.qos.logback.core.encoder.ObjectStreamEncoder.START_PEBBLE;
-import static ch.qos.logback.core.encoder.ObjectStreamEncoder.STOP_PEBBLE;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Restitute the contents of an input stream as java objects.
- *
- * @author Ceki Gülcü
- *
- * @param
- */
-public class EventObjectInputStream extends InputStream {
-
- NonClosableInputStream ncis;
- List buffer = new ArrayList();
-
- int index = 0;
-
- EventObjectInputStream(InputStream is) throws IOException {
- this.ncis = new NonClosableInputStream(is);
- }
-
- @Override
- public int read() throws IOException {
- throw new UnsupportedOperationException("Only the readEvent method is supported.");
- }
-
- /**
- * Returns the number of bytes available
- */
- public int available() throws IOException {
- return ncis.available();
- }
-
- public E readEvent() throws IOException {
-
- E event = getFromBuffer();
- if (event != null) {
- return event;
- }
-
- internalReset();
- int count = readHeader();
- if (count == -1) {
- return null;
- }
- readPayload(count);
- readFooter(count);
- return getFromBuffer();
- }
-
- private void internalReset() {
- index = 0;
- buffer.clear();
- }
-
- E getFromBuffer() {
- if (index >= buffer.size()) {
- return null;
- }
- return buffer.get(this.index++);
- }
-
- int readHeader() throws IOException {
- byte[] headerBA = new byte[4 * BYTES_PER_INT];
- // System.out.println("available="+ncis.available());
- int bytesRead = ncis.read(headerBA);
- if (bytesRead == -1) {
- return -1;
- }
- // System.out.println("**bytesRead="+bytesRead);
-
- // System.out.println(ByteArrayUtil.toHexString(headerBA));
-
- int offset = 0;
- int startPebble = ByteArrayUtil.readInt(headerBA, offset);
- if (startPebble != START_PEBBLE) {
- throw new IllegalStateException("Does not look like data created by ObjectStreamEncoder");
- }
- offset += BYTES_PER_INT;
- int count = ByteArrayUtil.readInt(headerBA, offset);
- offset += BYTES_PER_INT;
- int endPointer = ByteArrayUtil.readInt(headerBA, offset);
- offset += BYTES_PER_INT;
- int checksum = ByteArrayUtil.readInt(headerBA, offset);
- if (checksum != (START_PEBBLE ^ count)) {
- throw new IllegalStateException("Invalid checksum");
- }
- return count;
- }
-
- @SuppressWarnings("unchecked")
- E readEvents(ObjectInputStream ois) throws IOException {
- E e = null;
- try {
- e = (E) ois.readObject();
- buffer.add(e);
- } catch (ClassNotFoundException e1) {
- // FIXME Auto-generated catch block
- e1.printStackTrace();
- }
- return e;
- }
-
- void readFooter(int count) throws IOException {
- byte[] headerBA = new byte[2 * BYTES_PER_INT];
- ncis.read(headerBA);
-
- int offset = 0;
- int stopPebble = ByteArrayUtil.readInt(headerBA, offset);
- if (stopPebble != STOP_PEBBLE) {
- throw new IllegalStateException("Looks like a corrupt stream");
- }
- offset += BYTES_PER_INT;
- int checksum = ByteArrayUtil.readInt(headerBA, offset);
- if (checksum != (STOP_PEBBLE ^ count)) {
- throw new IllegalStateException("Invalid checksum");
- }
- }
-
- void readPayload(int count) throws IOException {
- List eventList = new ArrayList(count);
- ObjectInputStream ois = new ObjectInputStream(ncis);
- for (int i = 0; i < count; i++) {
- E e = (E) readEvents(ois);
- eventList.add(e);
- }
- ois.close();
- }
-
- public void close() throws IOException {
- ncis.realClose();
- }
-
-}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java 2016-02-25 21:15:15.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java 2017-04-01 00:34:00.000000000 +0000
@@ -13,13 +13,12 @@
*/
package ch.qos.logback.core.encoder;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
+import ch.qos.logback.core.Appender;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.Layout;
+import ch.qos.logback.core.OutputStreamAppender;
public class LayoutWrappingEncoder extends EncoderBase {
@@ -34,22 +33,8 @@
*/
private Charset charset;
- private boolean immediateFlush = true;
-
- /**
- * Sets the immediateFlush option. The default value for immediateFlush is 'true'. If set to true,
- * the doEncode() method will immediately flush the underlying OutputStream. Although immediate flushing
- * is safer, it also significantly degrades logging throughput.
- *
- * @since 1.0.3
- */
- public void setImmediateFlush(boolean immediateFlush) {
- this.immediateFlush = immediateFlush;
- }
-
- public boolean isImmediateFlush() {
- return immediateFlush;
- }
+ Appender> parent;
+ Boolean immediateFlush = null;
public Layout getLayout() {
return layout;
@@ -77,60 +62,58 @@
this.charset = charset;
}
- public void init(OutputStream os) throws IOException {
- super.init(os);
- writeHeader();
- }
-
- void writeHeader() throws IOException {
- if (layout != null && (outputStream != null)) {
- StringBuilder sb = new StringBuilder();
- appendIfNotNull(sb, layout.getFileHeader());
- appendIfNotNull(sb, layout.getPresentationHeader());
- if (sb.length() > 0) {
- sb.append(CoreConstants.LINE_SEPARATOR);
- // If at least one of file header or presentation header were not
- // null, then append a line separator.
- // This should be useful in most cases and should not hurt.
- outputStream.write(convertToBytes(sb.toString()));
- outputStream.flush();
- }
- }
+ /**
+ * Sets the immediateFlush option. The default value for immediateFlush is 'true'. If set to true,
+ * the doEncode() method will immediately flush the underlying OutputStream. Although immediate flushing
+ * is safer, it also significantly degrades logging throughput.
+ *
+ * @since 1.0.3
+ */
+ public void setImmediateFlush(boolean immediateFlush) {
+ addWarn("As of version 1.2.0 \"immediateFlush\" property should be set within the enclosing Appender.");
+ addWarn("Please move \"immediateFlush\" property into the enclosing appender.");
+ this.immediateFlush = immediateFlush;
}
- public void close() throws IOException {
- writeFooter();
+ @Override
+ public byte[] headerBytes() {
+ if (layout == null)
+ return null;
+
+ StringBuilder sb = new StringBuilder();
+ appendIfNotNull(sb, layout.getFileHeader());
+ appendIfNotNull(sb, layout.getPresentationHeader());
+ if (sb.length() > 0) {
+ // If at least one of file header or presentation header were not
+ // null, then append a line separator.
+ // This should be useful in most cases and should not hurt.
+ sb.append(CoreConstants.LINE_SEPARATOR);
+ }
+ return convertToBytes(sb.toString());
}
- void writeFooter() throws IOException {
- if (layout != null && outputStream != null) {
- StringBuilder sb = new StringBuilder();
- appendIfNotNull(sb, layout.getPresentationFooter());
- appendIfNotNull(sb, layout.getFileFooter());
- if (sb.length() > 0) {
- outputStream.write(convertToBytes(sb.toString()));
- outputStream.flush();
- }
- }
+ @Override
+ public byte[] footerBytes() {
+ if (layout == null)
+ return null;
+
+ StringBuilder sb = new StringBuilder();
+ appendIfNotNull(sb, layout.getPresentationFooter());
+ appendIfNotNull(sb, layout.getFileFooter());
+ return convertToBytes(sb.toString());
}
private byte[] convertToBytes(String s) {
if (charset == null) {
return s.getBytes();
} else {
- try {
- return s.getBytes(charset.name());
- } catch (UnsupportedEncodingException e) {
- throw new IllegalStateException("An existing charset cannot possibly be unsupported.");
- }
+ return s.getBytes(charset);
}
}
- public void doEncode(E event) throws IOException {
+ public byte[] encode(E event) {
String txt = layout.doLayout(event);
- outputStream.write(convertToBytes(txt));
- if (immediateFlush)
- outputStream.flush();
+ return convertToBytes(txt);
}
public boolean isStarted() {
@@ -138,17 +121,21 @@
}
public void start() {
+ if (immediateFlush != null) {
+ if (parent instanceof OutputStreamAppender) {
+ addWarn("Setting the \"immediateFlush\" property of the enclosing appender to " + immediateFlush);
+ @SuppressWarnings("unchecked")
+ OutputStreamAppender parentOutputStreamAppender = (OutputStreamAppender) parent;
+ parentOutputStreamAppender.setImmediateFlush(immediateFlush);
+ } else {
+ addError("Could not set the \"immediateFlush\" property of the enclosing appender.");
+ }
+ }
started = true;
}
public void stop() {
started = false;
- if (outputStream != null) {
- try {
- outputStream.flush();
- } catch (IOException e) {
- }
- }
}
private void appendIfNotNull(StringBuilder sb, String s) {
@@ -157,4 +144,13 @@
}
}
+ /**
+ * This method allows RollingPolicy implementations to be aware of their
+ * containing appender.
+ *
+ * @param appender
+ */
+ public void setParent(Appender> parent) {
+ this.parent = parent;
+ }
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java 2016-02-25 21:15:19.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/encoder/ObjectStreamEncoder.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,95 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.encoder;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import ch.qos.logback.core.CoreConstants;
-
-/**
- * Write out events as java objects.
- *
- * @author Ceki Gülcü
- *
- * @param
- */
-public class ObjectStreamEncoder extends EncoderBase {
-
- static public final int START_PEBBLE = 1853421169;
- static public final int STOP_PEBBLE = 640373619;
-
- private int MAX_BUFFER_SIZE = 100;
-
- List bufferList = new ArrayList(MAX_BUFFER_SIZE);
-
- public void doEncode(E event) throws IOException {
- bufferList.add(event);
- if (bufferList.size() == MAX_BUFFER_SIZE) {
- writeBuffer();
- }
- }
-
- void writeHeader(ByteArrayOutputStream baos, int bufferSize) {
- ByteArrayUtil.writeInt(baos, START_PEBBLE);
- ByteArrayUtil.writeInt(baos, bufferSize);
- ByteArrayUtil.writeInt(baos, 0);
- ByteArrayUtil.writeInt(baos, START_PEBBLE ^ bufferSize);
- }
-
- void writeFooter(ByteArrayOutputStream baos, int bufferSize) {
- ByteArrayUtil.writeInt(baos, STOP_PEBBLE);
- ByteArrayUtil.writeInt(baos, STOP_PEBBLE ^ bufferSize);
- }
-
- void writeBuffer() throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(10000);
-
- int size = bufferList.size();
- writeHeader(baos, size);
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- for (E e : bufferList) {
- oos.writeObject(e);
- }
- bufferList.clear();
- oos.flush();
-
- writeFooter(baos, size);
-
- byte[] byteArray = baos.toByteArray();
- oos.close();
- writeEndPosition(byteArray);
- outputStream.write(byteArray);
-
- }
-
- void writeEndPosition(byte[] byteArray) {
- int offset = 2 * CoreConstants.BYTES_PER_INT;
- ByteArrayUtil.writeInt(byteArray, offset, byteArray.length - offset);
- }
-
- @Override
- public void init(OutputStream os) throws IOException {
- super.init(os);
- bufferList.clear();
- }
-
- public void close() throws IOException {
- writeBuffer();
- }
-}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java 2017-01-20 17:53:07.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java 2017-03-30 02:48:10.000000000 +0000
@@ -25,6 +25,7 @@
import ch.qos.logback.core.recovery.ResilientFileOutputStream;
import ch.qos.logback.core.util.ContextUtil;
+import ch.qos.logback.core.util.FileSize;
import ch.qos.logback.core.util.FileUtil;
/**
@@ -37,6 +38,8 @@
*/
public class FileAppender extends OutputStreamAppender {
+ public static final long DEFAULT_BUFFER_SIZE = 8192;
+
static protected String COLLISION_WITH_EARLIER_APPENDER_URL = CODES_URL + "#earlier_fa_collision";
/**
@@ -53,6 +56,8 @@
private boolean prudent = false;
+ private FileSize bufferSize = new FileSize(DEFAULT_BUFFER_SIZE);
+
/**
* The File property takes a string value which should be the name of
* the file to append to.
@@ -196,7 +201,7 @@
addError("Failed to create parent directories for [" + file.getAbsolutePath() + "]");
}
- ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(file, append);
+ ResilientFileOutputStream resilientFos = new ResilientFileOutputStream(file, append, bufferSize.getSize());
resilientFos.setContext(context);
setOutputStream(resilientFos);
} finally {
@@ -226,6 +231,11 @@
public void setAppend(boolean append) {
this.append = append;
}
+
+ public void setBufferSize(FileSize bufferSize) {
+ addInfo("Setting bufferSize to ["+bufferSize.toString()+"]");
+ this.bufferSize = bufferSize;
+ }
private void safeWrite(E event) throws IOException {
ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/joran/action/ParamAction.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/joran/action/ParamAction.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/joran/action/ParamAction.java 2016-03-29 14:04:46.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/joran/action/ParamAction.java 2017-03-30 02:48:10.000000000 +0000
@@ -21,7 +21,7 @@
public class ParamAction extends Action {
static String NO_NAME = "No name attribute in element";
- static String NO_VALUE = "No name attribute in element";
+ static String NO_VALUE = "No value attribute in element";
boolean inError = false;
private final BeanDescriptionCache beanDescriptionCache;
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java 2016-11-25 19:36:01.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java 2017-03-30 02:48:10.000000000 +0000
@@ -50,7 +50,7 @@
urlConnection.setUseCaches(false);
in = urlConnection.getInputStream();
- doConfigure(in);
+ doConfigure(in, url.toExternalForm());
} catch (IOException ioe) {
String errMsg = "Could not open URL [" + url + "].";
addError(errMsg, ioe);
@@ -75,9 +75,10 @@
public final void doConfigure(File file) throws JoranException {
FileInputStream fis = null;
try {
- informContextOfURLUsedForConfiguration(getContext(), file.toURI().toURL());
+ URL url = file.toURI().toURL();
+ informContextOfURLUsedForConfiguration(getContext(), url);
fis = new FileInputStream(file);
- doConfigure(fis);
+ doConfigure(fis, url.toExternalForm());
} catch (IOException ioe) {
String errMsg = "Could not open [" + file.getPath() + "].";
addError(errMsg, ioe);
@@ -103,6 +104,12 @@
doConfigure(new InputSource(inputStream));
}
+ public final void doConfigure(InputStream inputStream, String systemId) throws JoranException {
+ InputSource inputSource = new InputSource(inputStream);
+ inputSource.setSystemId(systemId);
+ doConfigure(inputSource);
+ }
+
protected BeanDescriptionCache getBeanDescriptionCache() {
if (beanDescriptionCache == null) {
beanDescriptionCache = new BeanDescriptionCache(getContext());
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/net/HardenedObjectInputStream.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/net/HardenedObjectInputStream.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/net/HardenedObjectInputStream.java 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/net/HardenedObjectInputStream.java 2017-03-30 02:48:10.000000000 +0000
@@ -0,0 +1,71 @@
+package ch.qos.logback.core.net;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InvalidClassException;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * HardenedObjectInputStream restricts the set of classes that can be deserialized to a set of
+ * explicitly whitelisted classes. This prevents certain type of attacks from being successful.
+ *
+ *
It is assumed that classes in the "java.lang" and "java.util" packages are
+ * always authorized.
+ *
+ * @author Ceki Gülcü
+ * @since 1.2.0
+ */
+public class HardenedObjectInputStream extends ObjectInputStream {
+
+ final List whitelistedClassNames;
+ final static String[] JAVA_PACKAGES = new String[] { "java.lang", "java.util" };
+
+ public HardenedObjectInputStream(InputStream in, String[] whilelist) throws IOException {
+ super(in);
+
+ this.whitelistedClassNames = new ArrayList();
+ if (whilelist != null) {
+ for (int i = 0; i < whilelist.length; i++) {
+ this.whitelistedClassNames.add(whilelist[i]);
+ }
+ }
+ }
+
+ public HardenedObjectInputStream(InputStream in, List whitelist) throws IOException {
+ super(in);
+
+ this.whitelistedClassNames = new ArrayList();
+ this.whitelistedClassNames.addAll(whitelist);
+ }
+
+ @Override
+ protected Class> resolveClass(ObjectStreamClass anObjectStreamClass) throws IOException, ClassNotFoundException {
+
+ String incomingClassName = anObjectStreamClass.getName();
+
+ if (!isWhitelisted(incomingClassName)) {
+ throw new InvalidClassException("Unauthorized deserialization attempt", anObjectStreamClass.getName());
+ }
+
+ return super.resolveClass(anObjectStreamClass);
+ }
+
+ private boolean isWhitelisted(String incomingClassName) {
+ for (int i = 0; i < JAVA_PACKAGES.length; i++) {
+ if (incomingClassName.startsWith(JAVA_PACKAGES[i]))
+ return true;
+ }
+ for (String whiteListed : whitelistedClassNames) {
+ if (incomingClassName.equals(whiteListed))
+ return true;
+ }
+ return false;
+ }
+
+ protected void addToWhitelist(List additionalAuthorizedClasses) {
+ whitelistedClassNames.addAll(additionalAuthorizedClasses);
+ }
+}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/net/JMSAppenderBase.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/net/JMSAppenderBase.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/net/JMSAppenderBase.java 2016-02-25 21:15:16.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/net/JMSAppenderBase.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,171 +0,0 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2015, QOS.ch. All rights 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.net;
-
-import java.util.Hashtable;
-import java.util.Properties;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import ch.qos.logback.core.AppenderBase;
-
-/**
- * This class serves as a base class for
- * JMSTopicAppender and JMSQueueAppender
- *
- * For more information about this appender, please refer to:
- * http://logback.qos.ch/manual/appenders.html#JMSAppenderBase
- *
- * @author Ceki Gülcü
- * @author Sébastien Pennec
- */
-public abstract class JMSAppenderBase extends AppenderBase {
-
- protected String securityPrincipalName;
- protected String securityCredentials;
- protected String initialContextFactoryName;
- protected String urlPkgPrefixes;
- protected String providerURL;
- protected String userName;
- protected String password;
-
- protected Object lookup(Context ctx, String name) throws NamingException {
- try {
- return ctx.lookup(name);
- } catch (NameNotFoundException e) {
- addError("Could not find name [" + name + "].");
- throw e;
- }
- }
-
- public Context buildJNDIContext() throws NamingException {
- Context jndi = null;
-
- // addInfo("Getting initial context.");
- if (initialContextFactoryName != null) {
- Properties env = buildEnvProperties();
- jndi = new InitialContext(env);
- } else {
- jndi = new InitialContext();
- }
- return jndi;
- }
-
- public Properties buildEnvProperties() {
- Properties env = new Properties();
- env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName);
- if (providerURL != null) {
- env.put(Context.PROVIDER_URL, providerURL);
- } else {
- addWarn("You have set InitialContextFactoryName option but not the " + "ProviderURL. This is likely to cause problems.");
- }
- if (urlPkgPrefixes != null) {
- env.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
- }
-
- if (securityPrincipalName != null) {
- env.put(Context.SECURITY_PRINCIPAL, securityPrincipalName);
- if (securityCredentials != null) {
- env.put(Context.SECURITY_CREDENTIALS, securityCredentials);
- } else {
- addWarn("You have set SecurityPrincipalName option but not the " + "SecurityCredentials. This is likely to cause problems.");
- }
- }
- return env;
- }
-
- /**
- * Returns the value of the InitialContextFactoryName option. See
- * {@link #setInitialContextFactoryName} for more details on the meaning of
- * this option.
- */
- public String getInitialContextFactoryName() {
- return initialContextFactoryName;
- }
-
- /**
- * Setting the InitialContextFactoryName method will cause this
- * JMSAppender instance to use the {@link
- * InitialContext#InitialContext(Hashtable)} method instead of the no-argument
- * constructor. If you set this option, you should also at least set the
- * ProviderURL option.
- *
- *
- * See also {@link #setProviderURL(String)}.
- */
- public void setInitialContextFactoryName(String initialContextFactoryName) {
- this.initialContextFactoryName = initialContextFactoryName;
- }
-
- public String getProviderURL() {
- return providerURL;
- }
-
- public void setProviderURL(String providerURL) {
- this.providerURL = providerURL;
- }
-
- public String getURLPkgPrefixes() {
- return urlPkgPrefixes;
- }
-
- public void setURLPkgPrefixes(String urlPkgPrefixes) {
- this.urlPkgPrefixes = urlPkgPrefixes;
- }
-
- public String getSecurityCredentials() {
- return securityCredentials;
- }
-
- public void setSecurityCredentials(String securityCredentials) {
- this.securityCredentials = securityCredentials;
- }
-
- public String getSecurityPrincipalName() {
- return securityPrincipalName;
- }
-
- public void setSecurityPrincipalName(String securityPrincipalName) {
- this.securityPrincipalName = securityPrincipalName;
- }
-
- public String getUserName() {
- return userName;
- }
-
- /**
- * The user name to use when {@link
- * javax.jms.TopicConnectionFactory#createTopicConnection(String, String)}
- * creating a topic session}. If you set this option, you should also set the
- * Password option. See {@link #setPassword(String)}.
- */
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- /**
- * The password to use when creating a topic session.
- */
- public void setPassword(String password) {
- this.password = password;
- }
-
-}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java 2016-02-25 21:15:20.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java 2017-03-30 02:48:10.000000000 +0000
@@ -44,18 +44,20 @@
/**
* All synchronization in this class is done via the lock object.
*/
- protected final ReentrantLock lock = new ReentrantLock(true);
+ protected final ReentrantLock lock = new ReentrantLock(false);
/**
* This is the {@link OutputStream outputStream} where output will be written.
*/
private OutputStream outputStream;
+ boolean immediateFlush = true;
+
/**
- * The underlying output stream used by this appender.
- *
- * @return
- */
+ * The underlying output stream used by this appender.
+ *
+ * @return
+ */
public OutputStream getOutputStream() {
return outputStream;
}
@@ -133,21 +135,11 @@
}
}
- void encoderInit() {
- if (encoder != null && this.outputStream != null) {
- try {
- encoder.init(outputStream);
- } catch (IOException ioe) {
- this.started = false;
- addStatus(new ErrorStatus("Failed to initialize encoder for appender named [" + name + "].", this, ioe));
- }
- }
- }
-
void encoderClose() {
if (encoder != null && this.outputStream != null) {
try {
- encoder.close();
+ byte[] footer = encoder.footerBytes();
+ writeBytes(footer);
} catch (IOException ioe) {
this.started = false;
addStatus(new ErrorStatus("Failed to write footer for appender named [" + name + "].", this, ioe));
@@ -170,7 +162,6 @@
try {
// close any previously opened output stream
closeOutputStream();
-
this.outputStream = outputStream;
if (encoder == null) {
addWarn("Encoder has not been set. Cannot invoke its init method.");
@@ -183,8 +174,35 @@
}
}
+ void encoderInit() {
+ if (encoder != null && this.outputStream != null) {
+ try {
+ byte[] header = encoder.headerBytes();
+ writeBytes(header);
+ } catch (IOException ioe) {
+ this.started = false;
+ addStatus(new ErrorStatus("Failed to initialize encoder for appender named [" + name + "].", this, ioe));
+ }
+ }
+ }
protected void writeOut(E event) throws IOException {
- this.encoder.doEncode(event);
+ byte[] byteArray = this.encoder.encode(event);
+ writeBytes(byteArray);
+ }
+
+ private void writeBytes(byte[] byteArray) throws IOException {
+ if(byteArray == null || byteArray.length == 0)
+ return;
+
+ lock.lock();
+ try {
+ this.outputStream.write(byteArray);
+ if (immediateFlush) {
+ this.outputStream.flush();
+ }
+ } finally {
+ lock.unlock();
+ }
}
/**
@@ -207,12 +225,11 @@
// the synchronization prevents the OutputStream from being closed while we
// are writing. It also prevents multiple threads from entering the same
// converter. Converters assume that they are in a synchronized block.
- lock.lock();
- try {
- writeOut(event);
- } finally {
- lock.unlock();
- }
+ // lock.lock();
+
+ byte[] byteArray = this.encoder.encode(event);
+ writeBytes(byteArray);
+
} catch (IOException ioe) {
// as soon as an exception occurs, move to non-started state
// and add a single ErrorStatus to the SM.
@@ -229,4 +246,12 @@
this.encoder = encoder;
}
+ public boolean isImmediateFlush() {
+ return immediateFlush;
+ }
+
+ public void setImmediateFlush(boolean immediateFlush) {
+ this.immediateFlush = immediateFlush;
+ }
+
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/pattern/PatternLayoutBase.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/pattern/PatternLayoutBase.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/pattern/PatternLayoutBase.java 2016-02-25 21:15:17.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/pattern/PatternLayoutBase.java 2017-03-30 02:48:11.000000000 +0000
@@ -13,6 +13,9 @@
*/
package ch.qos.logback.core.pattern;
+import java.util.HashMap;
+import java.util.Map;
+
import ch.qos.logback.core.Context;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.LayoutBase;
@@ -22,18 +25,16 @@
import ch.qos.logback.core.status.ErrorStatus;
import ch.qos.logback.core.status.StatusManager;
-import java.util.HashMap;
-import java.util.Map;
-
abstract public class PatternLayoutBase extends LayoutBase {
+ static final int INTIAL_STRING_BUILDER_SIZE = 256;
Converter head;
String pattern;
protected PostCompileProcessor postCompileProcessor;
-
+
Map instanceConverterMap = new HashMap();
protected boolean outputPatternAsHeader = false;
-
+
/**
* Concrete implementations of this class are responsible for elaborating the
* mapping between pattern words and converters.
@@ -108,13 +109,13 @@
}
protected String writeLoopOnConverters(E event) {
- StringBuilder buf = new StringBuilder(128);
+ StringBuilder strBuilder = new StringBuilder(INTIAL_STRING_BUILDER_SIZE);
Converter c = head;
while (c != null) {
- c.write(buf, event);
+ c.write(strBuilder, event);
c = c.getNext();
}
- return buf.toString();
+ return strBuilder.toString();
}
public String getPattern() {
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java 2016-02-25 21:15:18.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java 2017-03-30 02:48:11.000000000 +0000
@@ -21,10 +21,10 @@
private File file;
private FileOutputStream fos;
- public ResilientFileOutputStream(File file, boolean append) throws FileNotFoundException {
+ public ResilientFileOutputStream(File file, boolean append, long bufferSize) throws FileNotFoundException {
this.file = file;
fos = new FileOutputStream(file, append);
- this.os = new BufferedOutputStream(fos);
+ this.os = new BufferedOutputStream(fos, (int) bufferSize);
this.presumedClean = true;
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/RollingCalendar.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/RollingCalendar.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/RollingCalendar.java 2016-03-27 11:10:49.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/RollingCalendar.java 2017-03-30 02:48:11.000000000 +0000
@@ -14,6 +14,9 @@
package ch.qos.logback.core.rolling.helper;
import static ch.qos.logback.core.CoreConstants.MILLIS_IN_ONE_HOUR;
+import static ch.qos.logback.core.CoreConstants.MILLIS_IN_ONE_MINUTE;
+import static ch.qos.logback.core.CoreConstants.MILLIS_IN_ONE_SECOND;
+import static ch.qos.logback.core.CoreConstants.MILLIS_IN_ONE_WEEK;
import static ch.qos.logback.core.CoreConstants.MILLIS_IN_ONE_DAY;
import java.text.SimpleDateFormat;
@@ -23,7 +26,6 @@
import java.util.Locale;
import java.util.TimeZone;
-import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.spi.ContextAwareBase;
/**
@@ -71,7 +73,6 @@
public PeriodicityType computePeriodicityType() {
GregorianCalendar calendar = new GregorianCalendar(GMT_TIMEZONE, Locale.getDefault());
-
// set sate to 1970-01-01 00:00:00 GMT
Date epoch = new Date(0);
@@ -180,25 +181,26 @@
if (start > end)
throw new IllegalArgumentException("Start cannot come before end");
- Date startFloored = getsStartOfCurrentPeriod(start);
- Date endFloored = getsStartOfCurrentPeriod(end);
-
- long diff = endFloored.getTime() - startFloored.getTime();
-
+ long startFloored = getStartOfCurrentPeriodWithGMTOffsetCorrection(start, getTimeZone());
+ long endFloored = getStartOfCurrentPeriodWithGMTOffsetCorrection(end, getTimeZone());
+
+ long diff = endFloored - startFloored;
+
switch (periodicityType) {
case TOP_OF_MILLISECOND:
return diff;
case TOP_OF_SECOND:
- return diff / CoreConstants.MILLIS_IN_ONE_SECOND;
+ return diff / MILLIS_IN_ONE_SECOND;
case TOP_OF_MINUTE:
- return diff / CoreConstants.MILLIS_IN_ONE_MINUTE;
+ return diff / MILLIS_IN_ONE_MINUTE;
case TOP_OF_HOUR:
- return (int) diff / CoreConstants.MILLIS_IN_ONE_HOUR;
+
+ return (int) diff / MILLIS_IN_ONE_HOUR;
case TOP_OF_DAY:
- return diff / CoreConstants.MILLIS_IN_ONE_DAY;
+ return diff / MILLIS_IN_ONE_DAY;
case TOP_OF_WEEK:
- return diff / CoreConstants.MILLIS_IN_ONE_WEEK;
+ return diff / MILLIS_IN_ONE_WEEK;
case TOP_OF_MONTH:
return diffInMonths(start, end);
default:
@@ -263,7 +265,7 @@
cal.set(Calendar.MILLISECOND, 0);
cal.add(Calendar.WEEK_OF_YEAR, numPeriods);
break;
-
+
case TOP_OF_MONTH:
cal.set(Calendar.DATE, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -287,10 +289,20 @@
public Date getNextTriggeringDate(Date now) {
return getEndOfNextNthPeriod(now, 1);
}
-
- public Date getsStartOfCurrentPeriod(long now) {
- Calendar aCal = Calendar.getInstance(getTimeZone());
- aCal.setTimeInMillis(now);
- return getEndOfNextNthPeriod(aCal.getTime(), 0);
+
+ public long getStartOfCurrentPeriodWithGMTOffsetCorrection(long now, TimeZone timezone) {
+ Date toppedDate;
+
+ // there is a bug in Calendar which prevents it from
+ // computing the correct DST_OFFSET when the time changes
+ {
+ Calendar aCal = Calendar.getInstance(timezone);
+ aCal.setTimeInMillis(now);
+ toppedDate = getEndOfNextNthPeriod(aCal.getTime(), 0);
+ }
+ Calendar secondCalendar = Calendar.getInstance(timezone);
+ secondCalendar.setTimeInMillis(toppedDate.getTime());
+ long gmtOffset = secondCalendar.get(Calendar.ZONE_OFFSET) + secondCalendar.get(Calendar.DST_OFFSET);
+ return toppedDate.getTime() + gmtOffset;
}
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java 2016-05-13 22:08:06.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java 2017-03-30 02:48:11.000000000 +0000
@@ -31,7 +31,7 @@
public class TimeBasedArchiveRemover extends ContextAwareBase implements ArchiveRemover {
static protected final long UNINITIALIZED = -1;
- // aim for 64 days, except in case of hourly rollover
+ // aim for 32 days, except in case of hourly rollover
static protected final long INACTIVITY_TOLERANCE_IN_MILLIS = 32L * (long) CoreConstants.MILLIS_IN_ONE_DAY;
static final int MAX_VALUE_FOR_INACTIVITY_PERIODS = 14 * 24; // 14 days in case of hourly rollover
@@ -48,9 +48,11 @@
this.parentClean = computeParentCleaningFlag(fileNamePattern);
}
+ int callCount = 0;
public void clean(Date now) {
+
long nowInMillis = now.getTime();
- // for a live appender periodsElapsed is usually one
+ // for a live appender periodsElapsed is expected to be 1
int periodsElapsed = computeElapsedPeriodsSinceLastClean(nowInMillis);
lastHeartBeat = nowInMillis;
if (periodsElapsed > 1) {
@@ -93,8 +95,8 @@
}
void capTotalSize(Date now) {
- int totalSize = 0;
- int totalRemoved = 0;
+ long totalSize = 0;
+ long totalRemoved = 0;
for (int offset = 0; offset < maxHistory; offset++) {
Date date = rc.getEndOfNextNthPeriod(now, -offset);
File[] matchingFileArray = getFilesInPeriod(date);
@@ -143,7 +145,7 @@
periodsElapsed = Math.min(periodsElapsed, MAX_VALUE_FOR_INACTIVITY_PERIODS);
} else {
periodsElapsed = rc.periodBarriersCrossed(lastHeartBeat, nowInMillis);
- // periodsElapsed of zero is possible for Size and time based policies
+ // periodsElapsed of zero is possible for size and time based policies
}
return (int) periodsElapsed;
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java 2016-12-09 16:26:37.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java 2017-03-30 02:48:11.000000000 +0000
@@ -179,7 +179,7 @@
if (archiveRemover != null) {
Date now = new Date(timeBasedFileNamingAndTriggeringPolicy.getCurrentTime());
- cleanUpFuture = archiveRemover.cleanAsynchronously(now);
+ this.cleanUpFuture = archiveRemover.cleanAsynchronously(now);
}
}
@@ -261,6 +261,7 @@
}
public void setTotalSizeCap(FileSize totalSizeCap) {
+ addInfo("setting totalSizeCap to "+totalSizeCap.toString());
this.totalSizeCap = totalSizeCap;
}
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachableImpl.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachableImpl.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachableImpl.java 2016-02-25 21:15:19.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachableImpl.java 2017-03-30 02:48:11.000000000 +0000
@@ -14,9 +14,9 @@
package ch.qos.logback.core.spi;
import java.util.Iterator;
-import java.util.concurrent.CopyOnWriteArrayList;
import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.util.COWArrayList;
/**
* A ReentrantReadWriteLock based implementation of the
@@ -26,7 +26,8 @@
*/
public class AppenderAttachableImpl implements AppenderAttachable {
- final private CopyOnWriteArrayList> appenderList = new CopyOnWriteArrayList>();
+ @SuppressWarnings("unchecked")
+ final private COWArrayList> appenderList = new COWArrayList>(new Appender[0]);
/**
* Attach an appender. If the appender is already in the list in won't be
@@ -44,8 +45,10 @@
*/
public int appendLoopOnAppenders(E e) {
int size = 0;
- for (Appender appender : appenderList) {
- appender.doAppend(e);
+ final Appender[] appenderArray = appenderList.asTypedArray();
+ final int len = appenderArray.length;
+ for (int i = 0; i < len; i++) {
+ appenderArray[i].doAppend(e);
size++;
}
return size;
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/spi/FilterAttachableImpl.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/spi/FilterAttachableImpl.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/spi/FilterAttachableImpl.java 2016-02-25 21:15:20.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/spi/FilterAttachableImpl.java 2017-03-30 02:48:11.000000000 +0000
@@ -15,9 +15,9 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
import ch.qos.logback.core.filter.Filter;
+import ch.qos.logback.core.util.COWArrayList;
/**
* Implementation of FilterAttachable.
@@ -26,7 +26,8 @@
*/
final public class FilterAttachableImpl implements FilterAttachable {
- CopyOnWriteArrayList> filterList = new CopyOnWriteArrayList>();
+ @SuppressWarnings("unchecked")
+ COWArrayList> filterList = new COWArrayList>(new Filter[0]);
/**
* Add a filter to end of the filter list.
@@ -48,12 +49,18 @@
* NEUTRAL, then NEUTRAL is returned.
*/
public FilterReply getFilterChainDecision(E event) {
- for (Filter f : filterList) {
- final FilterReply r = f.decide(event);
+
+ final Filter[] filterArrray = filterList.asTypedArray();
+ final int len = filterArrray.length;
+
+ for (int i = 0; i < len; i++) {
+ final FilterReply r = filterArrray[i].decide(event);
if (r == FilterReply.DENY || r == FilterReply.ACCEPT) {
return r;
}
}
+
+ // no decision
return FilterReply.NEUTRAL;
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/status/OnConsoleStatusListener.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/status/OnConsoleStatusListener.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/status/OnConsoleStatusListener.java 2016-02-25 21:15:18.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/status/OnConsoleStatusListener.java 2017-03-30 02:48:11.000000000 +0000
@@ -21,7 +21,8 @@
* @author Ceki Gülcü
*/
public class OnConsoleStatusListener extends OnPrintStreamStatusListenerBase {
-
+
+
@Override
protected PrintStream getPrintStream() {
return System.out;
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/status/OnPrintStreamStatusListenerBase.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/status/OnPrintStreamStatusListenerBase.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/status/OnPrintStreamStatusListenerBase.java 2016-11-08 07:33:38.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/status/OnPrintStreamStatusListenerBase.java 2017-03-30 02:48:11.000000000 +0000
@@ -24,13 +24,19 @@
* Print all new incoming status messages on the on the designated PrintStream.
* @author Ceki Gülcü
*/
-abstract class OnPrintStreamStatusListenerBase extends ContextAwareBase implements StatusListener, LifeCycle {
+abstract public class OnPrintStreamStatusListenerBase extends ContextAwareBase implements StatusListener, LifeCycle {
boolean isStarted = false;
static final long DEFAULT_RETROSPECTIVE = 300;
long retrospectiveThresold = DEFAULT_RETROSPECTIVE;
-
+
+ /**
+ * The prefix to place before each status message
+ * @since 1.1.10
+ */
+ String prefix;
+
/**
* The PrintStream used by derived classes
* @return
@@ -39,6 +45,9 @@
private void print(Status status) {
StringBuilder sb = new StringBuilder();
+ if(prefix != null)
+ sb.append(prefix);
+
StatusPrinter.buildStr(sb, "", status);
getPrintStream().print(sb);
}
@@ -82,6 +91,14 @@
}
}
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
public void setRetrospective(long retrospective) {
this.retrospectiveThresold = retrospective;
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/ContextUtil.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/ContextUtil.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/ContextUtil.java 2017-01-20 17:50:04.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/ContextUtil.java 2017-03-30 02:48:11.000000000 +0000
@@ -13,11 +13,6 @@
*/
package ch.qos.logback.core.util;
-import ch.qos.logback.core.Context;
-import ch.qos.logback.core.CoreConstants;
-import ch.qos.logback.core.rolling.helper.FileNamePattern;
-import ch.qos.logback.core.spi.ContextAwareBase;
-
import static ch.qos.logback.core.CoreConstants.FA_FILENAME_COLLISION_MAP;
import static ch.qos.logback.core.CoreConstants.RFA_FILENAME_PATTERN_COLLISION_MAP;
@@ -31,6 +26,11 @@
import java.util.Map;
import java.util.Properties;
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.CoreConstants;
+import ch.qos.logback.core.rolling.helper.FileNamePattern;
+import ch.qos.logback.core.spi.ContextAwareBase;
+
public class ContextUtil extends ContextAwareBase {
public ContextUtil(Context context) {
@@ -67,10 +67,10 @@
/**
* Add the local host's name as a property
*/
- public void addHostNameAsProperty() {
+ public String safelyGetLocalHostName() {
try {
String localhostName = getLocalHostName();
- context.putProperty(CoreConstants.HOSTNAME_KEY, localhostName);
+ return localhostName;
} catch (UnknownHostException e) {
addError("Failed to get local hostname", e);
} catch (SocketException e) {
@@ -78,6 +78,7 @@
} catch (SecurityException e) {
addError("Failed to get local hostname", e);
}
+ return CoreConstants.UNKNOWN_LOCALHOST;
}
public void addProperties(Properties props) {
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/COWArrayList.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/COWArrayList.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/COWArrayList.java 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/COWArrayList.java 2017-03-30 02:48:11.000000000 +0000
@@ -0,0 +1,227 @@
+package ch.qos.logback.core.util;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * A GC-free lock-free thread-safe implementation of the {@link List} interface for use cases where iterations over the list vastly out-number modifications on the list.
+ *
+ *
Underneath, it wraps an instance of {@link CopyOnWriteArrayList} and exposes a copy of the array used by that instance.
+ *
+ *
Typical use:
+ *
+ *
+ * COWArrayList list = new COWArrayList(new Integer[0]);
+ *
+ * // modify the list
+ * list.add(1);
+ * list.add(2);
+ *
+ * Integer[] intArray = list.asTypedArray();
+ * int sum = 0;
+ * // iteration over the array is thread-safe
+ * for(int i = 0; i < intArray.length; i++) {
+ * sum != intArray[i];
+ * }
+ *
+ *
+ *
If the list is not modified, then repetitive calls to {@link #asTypedArray()}, {@link #toArray()} and
+ * {@link #toArray(Object[])} are guaranteed to be GC-free. Note that iterating over the list using
+ * {@link COWArrayList#iterator()} and {@link COWArrayList#listIterator()} are not GC-free.
+ *
+ * @author Ceki Gulcu
+ * @since 1.1.10
+ */
+public class COWArrayList implements List {
+
+ // Implementation note: markAsStale() should always be invoked *after* list-modifying actions.
+ // If not, readers might get a stale array until the next write. The potential problem is nicely
+ // explained by Rob Eden. See https://github.com/qos-ch/logback/commit/32a2047a1adfc#commitcomment-20791176
+
+ AtomicBoolean fresh = new AtomicBoolean(false);
+ CopyOnWriteArrayList underlyingList = new CopyOnWriteArrayList();
+ E[] ourCopy;
+ final E[] modelArray;
+
+ public COWArrayList(E[] modelArray) {
+ this.modelArray = modelArray;
+ }
+
+ @Override
+ public int size() {
+ return underlyingList.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return underlyingList.isEmpty();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return underlyingList.contains(o);
+ }
+
+ @Override
+ public Iterator iterator() {
+ return underlyingList.iterator();
+ }
+
+ private void refreshCopyIfNecessary() {
+ if (!isFresh()) {
+ refreshCopy();
+ }
+ }
+
+ private boolean isFresh() {
+ return fresh.get();
+ }
+
+ private void refreshCopy() {
+ ourCopy = underlyingList.toArray(modelArray);
+ fresh.set(true);
+ }
+
+ @Override
+ public Object[] toArray() {
+ refreshCopyIfNecessary();
+ return ourCopy;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public T[] toArray(T[] a) {
+ refreshCopyIfNecessary();
+ return (T[]) ourCopy;
+ }
+
+ /**
+ * Return an array of type E[]. The returned array is intended to be iterated over.
+ * If the list is modified, subsequent calls to this method will return different/modified
+ * array instances.
+ *
+ * @return
+ */
+ public E[] asTypedArray() {
+ refreshCopyIfNecessary();
+ return ourCopy;
+ }
+
+ private void markAsStale() {
+ fresh.set(false);
+ }
+
+ public void addIfAbsent(E e) {
+ underlyingList.addIfAbsent(e);
+ markAsStale();
+ }
+
+ @Override
+ public boolean add(E e) {
+ boolean result = underlyingList.add(e);
+ markAsStale();
+ return result;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ boolean result = underlyingList.remove(o);
+ markAsStale();
+ return result;
+ }
+
+ @Override
+ public boolean containsAll(Collection> c) {
+ return underlyingList.containsAll(c);
+ }
+
+ @Override
+ public boolean addAll(Collection extends E> c) {
+ boolean result = underlyingList.addAll(c);
+ markAsStale();
+ return result;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection extends E> col) {
+ boolean result = underlyingList.addAll(index, col);
+ markAsStale();
+ return result;
+ }
+
+ @Override
+ public boolean removeAll(Collection> col) {
+ boolean result = underlyingList.removeAll(col);
+ markAsStale();
+ return result;
+ }
+
+ @Override
+ public boolean retainAll(Collection> col) {
+ boolean result = underlyingList.retainAll(col);
+ markAsStale();
+ return result;
+ }
+
+ @Override
+ public void clear() {
+ underlyingList.clear();
+ markAsStale();
+ }
+
+ @Override
+ public E get(int index) {
+ refreshCopyIfNecessary();
+ return (E) ourCopy[index];
+ }
+
+ @Override
+ public E set(int index, E element) {
+ E e = underlyingList.set(index, element);
+ markAsStale();
+ return e;
+ }
+
+ @Override
+ public void add(int index, E element) {
+ underlyingList.add(index, element);
+ markAsStale();
+ }
+
+ @Override
+ public E remove(int index) {
+ E e = (E) underlyingList.remove(index);
+ markAsStale();
+ return e;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return underlyingList.indexOf(o);
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return underlyingList.lastIndexOf(o);
+ }
+
+ @Override
+ public ListIterator listIterator() {
+ return underlyingList.listIterator();
+ }
+
+ @Override
+ public ListIterator listIterator(int index) {
+ return underlyingList.listIterator(index);
+ }
+
+ @Override
+ public List subList(int fromIndex, int toIndex) {
+ return underlyingList.subList(fromIndex, toIndex);
+ }
+
+}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/FileSize.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/FileSize.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/FileSize.java 2016-03-02 22:01:59.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/FileSize.java 2017-03-30 02:48:11.000000000 +0000
@@ -91,6 +91,12 @@
return inKB + " KB";
}
- return inMB + " MB";
+ long inGB = size / GB_COEFFICIENT;
+ if(inGB == 0) {
+ return inMB + " MB";
+ }
+
+ return inGB + " GB";
+
}
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/FixedDelay.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/FixedDelay.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/FixedDelay.java 2016-02-25 21:15:17.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/FixedDelay.java 2017-03-30 02:48:11.000000000 +0000
@@ -32,7 +32,6 @@
* @param subsequentDelay value for all other delays
*/
public FixedDelay(long initialDelay, long subsequentDelay) {
- String s = new String();
this.nextDelay = initialDelay;
this.subsequentDelay = subsequentDelay;
}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/InterruptUtil.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/InterruptUtil.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/InterruptUtil.java 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/InterruptUtil.java 2017-03-30 02:48:11.000000000 +0000
@@ -0,0 +1,54 @@
+package ch.qos.logback.core.util;
+
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.spi.ContextAwareBase;
+
+/**
+ * Allows masking of interrupt flag if previously the flag is already set. Does nothing otherwise.
+ *
+ * Typical use:
+ *
+ *
+ * InterruptUtil interruptUtil = new InterruptUtil(context);
+ *
+ * try {
+ * interruptUtil.maskInterruptFlag();
+ * someOtherThread.join(delay);
+ * } catch(InterruptedException e) {
+ * // reachable only if join does not succeed within delay.
+ * // Without the maskInterruptFlag() call, the join() would have returned immediately
+ * // had the current thread been interrupted previously, i.e. before entering the above block
+ * } finally {
+ * interruptUtil.unmaskInterruptFlag();
+ * }
+ *
+ * @author Ceki Gulcu
+ * @since 1.2.2
+ */
+public class InterruptUtil extends ContextAwareBase {
+
+ final boolean previouslyInterrupted;
+
+ public InterruptUtil(Context context) {
+ super();
+ setContext(context);
+ previouslyInterrupted = Thread.currentThread().isInterrupted();
+ }
+
+ public void maskInterruptFlag() {
+ if (previouslyInterrupted) {
+ Thread.interrupted();
+ }
+ }
+
+ public void unmaskInterruptFlag() {
+ if (previouslyInterrupted) {
+ try {
+ Thread.currentThread().interrupt();
+ } catch (SecurityException se) {
+ addError("Failed to intrreupt current thread", se);
+ }
+ }
+ }
+
+}
diff -Nru logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/StatusListenerConfigHelper.java logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/StatusListenerConfigHelper.java
--- logback-1.1.9/logback-core/src/main/java/ch/qos/logback/core/util/StatusListenerConfigHelper.java 2016-02-25 21:15:19.000000000 +0000
+++ logback-1.2.3/logback-core/src/main/java/ch/qos/logback/core/util/StatusListenerConfigHelper.java 2017-03-30 02:48:11.000000000 +0000
@@ -23,7 +23,7 @@
public class StatusListenerConfigHelper {
public static void installIfAsked(Context context) {
- String slClass = OptionHelper.getSystemProperty(CoreConstants.STATUS_LISTENER_CLASS);
+ String slClass = OptionHelper.getSystemProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY);
if (!OptionHelper.isEmpty(slClass)) {
addStatusListener(context, slClass);
}
@@ -45,7 +45,6 @@
((ContextAware) listener).setContext(context);
boolean effectivelyAdded = context.getStatusManager().add(listener);
- effectivelyAdded = true;
if (effectivelyAdded && (listener instanceof LifeCycle)) {
((LifeCycle) listener).start(); // LOGBACK-767
}
diff -Nru logback-1.1.9/logback-core/src/test/input/compress1.txt logback-1.2.3/logback-core/src/test/input/compress1.txt
--- logback-1.1.9/logback-core/src/test/input/compress1.txt 2017-01-20 18:53:20.000000000 +0000
+++ logback-1.2.3/logback-core/src/test/input/compress1.txt 1970-01-01 00:00:00.000000000 +0000
@@ -1,8 +0,0 @@
-
- LOGBack: the generic, reliable, fast and flexible logging framework.
-
- Copyright (C) 1999-2006, QOS.ch
-
- This library is free software, you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by the Free
- Software Foundation.
diff -Nru logback-1.1.9/logback-core/src/test/input/compress2.txt logback-1.2.3/logback-core/src/test/input/compress2.txt
--- logback-1.1.9/logback-core/src/test/input/compress2.txt 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/logback-core/src/test/input/compress2.txt 2017-04-01 03:20:03.000000000 +0000
@@ -0,0 +1,34 @@
+
+
+
+
+ LOGBack Home
+
+
+
+
+
+
LOGBack project
+
+
LOGBack is intended as a successor to the popular log4j
+ project. It was also designed by Ceki Gülcü, the founder
+ of the log4j project. It builds upon exerience gained in building
+ industrial-strength logging systems going back as far as 1999.
+
+
+
LOGBack's basic architecture is sufficiently generic so as to
+ apply under different circumstances. At present time, LOGBack is
+ divided into three modules, Core, Classic and Access.
+
+
+
The Core module lays the groundwork for the other two
+ modules. The Classic module can be assimilated to an improved
+ version of log4j. The Access module integrates with Servlet
+ containers to provide HTPP-access log functionality. Note that you
+ can easily build your own modules on top of the Core module.
+
javax.servlet
- servlet-api
+ javax.servlet-apicompiletrue
@@ -89,7 +90,7 @@
cobertura-maven-plugin${cobertura.maven.plugin.version}
-
+ chapters/**/*.class
@@ -97,7 +98,6 @@
-
\ No newline at end of file
diff -Nru logback-1.1.9/logback-examples/setClasspath.cmd logback-1.2.3/logback-examples/setClasspath.cmd
--- logback-1.1.9/logback-examples/setClasspath.cmd 2017-01-20 18:53:49.000000000 +0000
+++ logback-1.2.3/logback-examples/setClasspath.cmd 2017-04-01 04:26:02.000000000 +0000
@@ -5,9 +5,9 @@
set LB_HOME=c:/SET/THIS/PARAMETER/TO/THE/FOLDER/WHERE/YOU/INSTALLED/LOGBACK
REM echo %LB_HOME%
-set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-classic-1.1.9.jar
-set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-core-1.1.9.jar
-set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/logback-examples-1.1.9.jar
-set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/lib/slf4j-api-1.7.22.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-classic-1.2.3.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-core-1.2.3.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/logback-examples-1.2.3.jar
+set CLASSPATH=%CLASSPATH%;%LB_HOME%/logback-examples/lib/slf4j-api-1.7.25.jar
REM echo %CLASSPATH%
diff -Nru logback-1.1.9/logback-examples/setClasspath.sh logback-1.2.3/logback-examples/setClasspath.sh
--- logback-1.1.9/logback-examples/setClasspath.sh 2017-01-20 18:53:49.000000000 +0000
+++ logback-1.2.3/logback-examples/setClasspath.sh 2017-04-01 04:26:02.000000000 +0000
@@ -6,10 +6,10 @@
LB_HOME=/SET/THIS/PARAMETER/TO/THE/DIRECTORY/WHERE/YOU/INSTALLED/LOGBACK
-CLASSPATH="${CLASSPATH}:${LB_HOME}/logback-classic-1.1.9.jar"
-CLASSPATH="${CLASSPATH}:${LB_HOME}/logback-core-1.1.9.jar"
-CLASSPATH="${CLASSPATH}:${LB_HOME}/logback-examples/logback-examples-1.1.9.jar"
-CLASSPATH="${CLASSPATH}:${LB_HOME}/logback-examples/lib/slf4j-api-1.7.22.jar"
+CLASSPATH="${CLASSPATH}:${LB_HOME}/logback-classic-1.2.3.jar"
+CLASSPATH="${CLASSPATH}:${LB_HOME}/logback-core-1.2.3.jar"
+CLASSPATH="${CLASSPATH}:${LB_HOME}/logback-examples/logback-examples-1.2.3.jar"
+CLASSPATH="${CLASSPATH}:${LB_HOME}/logback-examples/lib/slf4j-api-1.7.25.jar"
export CLASSPATH
diff -Nru logback-1.1.9/logback-examples/src/main/java/chapters/appenders/CountingConsoleAppender.java logback-1.2.3/logback-examples/src/main/java/chapters/appenders/CountingConsoleAppender.java
--- logback-1.1.9/logback-examples/src/main/java/chapters/appenders/CountingConsoleAppender.java 2016-02-25 21:15:53.000000000 +0000
+++ logback-1.2.3/logback-examples/src/main/java/chapters/appenders/CountingConsoleAppender.java 2017-03-30 02:48:11.000000000 +0000
@@ -13,18 +13,16 @@
*/
package chapters.appenders;
-import java.io.IOException;
-
-import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;
+import ch.qos.logback.core.Layout;
public class CountingConsoleAppender extends AppenderBase {
static int DEFAULT_LIMIT = 10;
int counter = 0;
int limit = DEFAULT_LIMIT;
- PatternLayoutEncoder encoder;
+ Layout layout;
public void setLimit(int limit) {
this.limit = limit;
@@ -36,15 +34,13 @@
@Override
public void start() {
- if (this.encoder == null) {
- addError("No encoder set for the appender named [" + name + "].");
+ if (this.layout == null) {
+ addError("No layout set for the appender named [" + name + "].");
return;
}
- try {
- encoder.init(System.out);
- } catch (IOException e) {
- }
+ String header = layout.getFileHeader();
+ System.out.print(header);
super.start();
}
@@ -52,21 +48,20 @@
if (counter >= limit) {
return;
}
- // output the events as formatted by the wrapped layout
- try {
- this.encoder.doEncode(event);
- } catch (IOException e) {
- }
+ // output the events as formatted by patternLayout
+ String eventStr = this.layout.doLayout(event);
+
+ System.out.print(eventStr);
// prepare for next event
counter++;
}
- public PatternLayoutEncoder getEncoder() {
- return encoder;
+ public Layout getLayout() {
+ return layout;
}
- public void setEncoder(PatternLayoutEncoder encoder) {
- this.encoder = encoder;
+ public void setLayout(Layout layout) {
+ this.layout = layout;
}
}
diff -Nru logback-1.1.9/logback-examples/src/main/java/chapters/migrationFromLog4j/LogbackMain.java logback-1.2.3/logback-examples/src/main/java/chapters/migrationFromLog4j/LogbackMain.java
--- logback-1.1.9/logback-examples/src/main/java/chapters/migrationFromLog4j/LogbackMain.java 2016-02-25 21:15:53.000000000 +0000
+++ logback-1.2.3/logback-examples/src/main/java/chapters/migrationFromLog4j/LogbackMain.java 2017-03-30 02:48:11.000000000 +0000
@@ -24,7 +24,7 @@
/**
* A minimal application making use of logback-classic. It uses the
* configuration file logback-trivial.xml which makes use of
- * TivialLogbackAppender.
+ * TrivialLogbackAppender.
*
* @author Ceki Gülcü
*/
diff -Nru logback-1.1.9/logback-examples/src/main/java/chapters/migrationFromLog4j/TrivialLogbackAppender.java logback-1.2.3/logback-examples/src/main/java/chapters/migrationFromLog4j/TrivialLogbackAppender.java
--- logback-1.1.9/logback-examples/src/main/java/chapters/migrationFromLog4j/TrivialLogbackAppender.java 2016-02-25 21:15:53.000000000 +0000
+++ logback-1.2.3/logback-examples/src/main/java/chapters/migrationFromLog4j/TrivialLogbackAppender.java 2017-03-30 02:48:11.000000000 +0000
@@ -13,48 +13,40 @@
*/
package chapters.migrationFromLog4j;
-import java.io.IOException;
-
-import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;
+import ch.qos.logback.core.Layout;
public class TrivialLogbackAppender extends AppenderBase {
- PatternLayoutEncoder encoder;
-
- public PatternLayoutEncoder getEncoder() {
- return encoder;
- }
-
- public void setEncoder(PatternLayoutEncoder encoder) {
- this.encoder = encoder;
- }
+ Layout layout;
@Override
public void start() {
- if (this.encoder == null) {
- addError("No encoder set for the appender named [" + name + "].");
+ if (this.layout == null) {
+ addError("No layout set for the appender named [" + name + "].");
return;
}
- try {
- encoder.init(System.out);
- } catch (IOException e) {
- }
+ String header = layout.getFileHeader();
+ System.out.println(header);
super.start();
}
@Override
- protected void append(ILoggingEvent loggingevent) {
+ protected void append(ILoggingEvent loggingEvent) {
// note that AppenderBase.doAppend will invoke this method only if
// this appender was successfully started.
- try {
- this.encoder.doEncode(loggingevent);
- } catch (IOException e) {
- // we can't do much with the exception except halting
- super.stop();
- addError("Failed to write to the console");
- }
+ String eventAsStr = this.layout.doLayout(loggingEvent);
+ System.out.println(eventAsStr);
+ }
+
+
+ public Layout getLayout() {
+ return layout;
+ }
+
+ public void setLayout(Layout layout) {
+ this.layout = layout;
}
}
diff -Nru logback-1.1.9/logback-site/pom.xml logback-1.2.3/logback-site/pom.xml
--- logback-1.1.9/logback-site/pom.xml 2017-01-20 18:37:25.000000000 +0000
+++ logback-1.2.3/logback-site/pom.xml 2017-04-01 03:15:20.000000000 +0000
@@ -7,7 +7,7 @@
ch.qos.logbacklogback-parent
- 1.1.9
+ 1.2.3logback-site
@@ -33,8 +33,17 @@
org.apache.maven.pluginsmaven-site-plugin
- ${project.parent.basedir}/target/site
-
+ ${project.parent.basedir}/target/site
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+
+ js
+
diff -Nru logback-1.1.9/logback-site/src/site/pages/js/dsl.js logback-1.2.3/logback-site/src/site/pages/js/dsl.js
--- logback-1.1.9/logback-site/src/site/pages/js/dsl.js 2016-02-10 21:53:10.000000000 +0000
+++ logback-1.2.3/logback-site/src/site/pages/js/dsl.js 2017-03-30 02:48:11.000000000 +0000
@@ -1,5 +1,5 @@
-var asGroovyURL='http://logback.qos.ch/translator/dsl/asGroovy';
+var asGroovyURL='https://logback.qos.ch/translator/dsl/asGroovy';
function asGroovy(id) {
diff -Nru logback-1.1.9/logback-site/src/site/pages/manual/appenders.html logback-1.2.3/logback-site/src/site/pages/manual/appenders.html
--- logback-1.1.9/logback-site/src/site/pages/manual/appenders.html 2016-03-30 18:43:42.000000000 +0000
+++ logback-1.2.3/logback-site/src/site/pages/manual/appenders.html 2017-03-30 02:48:11.000000000 +0000
@@ -272,7 +272,24 @@
underlying OutputStreamAppender. Encoders are
described in a dedicated chapter.
-
+
+
+
immediateFlush
+
boolean
+
+
The default value for immediateFlush is 'true'. Immediate
+ flushing of the output stream ensures that logging events are
+ immediately written out and will not be lost in case your
+ application exits without properly closing appenders. On the
+ other hand, setting this property to 'false' is likely to
+ quadruple (your mileage may vary) logging throughput. Again, if
+ immediateFlush is set to 'false' and
+ if appenders are not closed properly when your application exits,
+ then logging events not yet written to disk may be lost.
+
+
+
@@ -435,7 +452,6 @@
-
prudent
@@ -509,11 +525,8 @@
events are not lost in case your application exits without properly
closing appenders. However, for significantly increased logging
throughput, you may want to set the immediateFlush property of the underlying
- Encoder to false . Encoders and in
- particular LayoutWrappingEncoder
- are described in a separate chapter.
+ class="prop">immediateFlush property to
+ false.
Below is an example of a configuration file for
FileAppender:
@@ -528,6 +541,8 @@
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>testFile.log</file>
<append>true</append>
+ <!-- set immediateFlush to false for much higher logging throughput -->
+ <immediateFlush>true</immediateFlush>
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
diff -Nru logback-1.1.9/logback-site/src/site/pages/manual/configuration.html logback-1.2.3/logback-site/src/site/pages/manual/configuration.html
--- logback-1.1.9/logback-site/src/site/pages/manual/configuration.html 2016-12-12 12:17:38.000000000 +0000
+++ logback-1.2.3/logback-site/src/site/pages/manual/configuration.html 2017-03-30 02:48:11.000000000 +0000
@@ -81,20 +81,21 @@
In order to release the resources used by logback-classic, it is
always a good idea to stop the logback context. Stopping the
@@ -800,7 +801,9 @@
the contextDestroyed
method of ServletContextListener in order to stop
- logback-classic and release resources.
+ logback-classic and release resources. Starting with version
+ 1.1.10, the appropriate ServletContextListener is
+ installed automatically for you (see just below).
Stopping logback-classic
@@ -823,8 +826,48 @@
can delay shutdown by a user specified duration. Note that you may
install a shutdown hook of your own making by setting the class attribute to correspond to your shutdown
- hook's class name..
+ hook's class name.
+
+
Stopping logback-classic
+ in web-applications
+
+
since 1.1.10 Logback-classic will
+ automatically ask the web-server to install a LogbackServletContainerInitializer
+ implementing the ServletContainerInitializer interface
+ (available in servlet-api 3.x and later). This initializer will in
+ turn install and instance of LogbackServletContextListener.
+ This listener will stop the current logback-classic context when
+ the web-app is stopped or reloaded.
+
+
+
You may disable the automatic the installation of
+ LogbackServletContextListener by setting a
+ <context-param> named
+ logbackDisableServletContainerInitializer in your
+ web-application's web.xml file. Here is the relevant snippet.
Note that
+ logbackDisableServletContainerInitializer variable
+ can also be set as a Java system property an OS environment
+ variable. The most local setting has priority, i.e. web-app first,
+ system property second and OS environment last.
+
+
+
+
+
Configuration file syntax
As you have seen thus far in the manual with plenty of examples
@@ -1470,7 +1513,12 @@
As they often come in handy, the HOSTNAME and CONTEXT_NAME
- variables are automatically defined and have context scope.
+ variables are automatically defined and have context scope. Given
+ that in some environments it may take some time to compute the
+ hostname, its value is computed lazily (only when needed). Moreover,
+ HOSTNAME can be set from within the configuration directly.
+
The doEncode() method starts by having the wrapped
layout convert the incoming event into string. The resulting text
string is converted to bytes according to the charset encoding
- chosen by the user. Those bytes are then written to the
- OutputStream given by the owning appender. By
- default, the OutputStream is immediately flushed,
- unless the immediateFlush property is
- explicitly set to 'false'. Setting the immediateFlush property to false can
- significantly improve logging throughput. See
- PatternLayoutEncoder below for sample configuration..
-
+ chosen by the user.
PatternLayoutEncoder
@@ -194,36 +184,9 @@
immediateFlush property
-
As a sub-class of LayoutWrappingEncoder,
- PatternLayoutEncoder admits the immediateFlush property. The default value
- for immediateFlush is 'true'. Immediate
- flushing of the output stream ensures that logging events are
- immediately written to disk and will not be lost in case your
- application exits without properly closing appenders. On the
- other hand, setting this property to 'false' is likely to
- quintuple (your mileage may vary) logging throughput. As
- mentioned previously, if immediateFlush
- is set to 'false' and if appenders are not closed properly when
- your application exits, then logging events not yet written to
- disk may be lost.
-
-
-
Below is a sample configuration for a
- FileAppender containing a
- PatternLayoutEncoder with its immediateFlush property set to 'false'.
As of logback 1.2.0, the
+ immediateFlush property is part of the
+ enclosing Appender.
Output pattern
string as header
diff -Nru logback-1.1.9/logback-site/src/site/pages/manual/layouts.html logback-1.2.3/logback-site/src/site/pages/manual/layouts.html
--- logback-1.1.9/logback-site/src/site/pages/manual/layouts.html 2016-03-30 18:43:42.000000000 +0000
+++ logback-1.2.3/logback-site/src/site/pages/manual/layouts.html 2017-03-30 02:48:11.000000000 +0000
@@ -819,7 +819,8 @@
full stack trace will be output.
-
The throwable conversion word can followed by one of
+
+
The throwable conversion word can followed by one of
the following options:
@@ -870,6 +871,17 @@
negative answer. Evaluators are described further
down in this document.
+
+
If you do not specify %throwable or another
+ throwable-related conversion word in the conversion pattern,
+ PatternLayout will automatically add it as the
+ last conversion word, on account of the importance of stack
+ trace information. The $nopex conversion word can be
+ substituted for %throwable, if you do not wish stack trace
+ information to be displayed. See also the %nopex conversion
+ word.
+
+
@@ -888,16 +900,6 @@
Same as the %throwable conversion word above with the
addition of class packaging information.
-
If you do not specify %xThrowable or another
- throwable-related conversion word in the conversion pattern,
- PatternLayout will automatically add it as the
- last conversion word, on account of the importance of stack
- trace information. The $nopex conversion word can be
- substituted for %xThrowable, if you do not wish stack
- trace information to be displayed. See also the %nopex
- conversion word.
-
-
At the end of each stack frame of the exception, a string
consisting of the jar file containing the relevant class
followed by the "Implementation-Version" as found in that
@@ -934,15 +936,18 @@
by a tilde, it is possible that the correct packaging data is
in reality [wombat.jar:1.7].
-
+
+
Please note that given its potential cost, computation of
+ packaging data
+ is disabled by default. When computation of
+ packaging data is enabled, PatternLayout will
+ automatically assume the %xThrowable suffix instead of
+ %throwable suffix at the end of the pattern string.
+
Feedback from
users indicates that Netbeans chokes on packaging
- information. If you are a Netbeans user, then you should
- disable packaging information in stack traces by adding
- "%ex" at the end of of your conversion pattern. For example,
- "%d %logger - %m%n" should be rewritten as "%d %logger -
- %m%n%ex"
+ information.
diff -Nru logback-1.1.9/logback-site/src/site/pages/manual/mdc.html logback-1.2.3/logback-site/src/site/pages/manual/mdc.html
--- logback-1.1.9/logback-site/src/site/pages/manual/mdc.html 2015-04-06 17:07:03.000000000 +0000
+++ logback-1.2.3/logback-site/src/site/pages/manual/mdc.html 2017-03-30 02:48:11.000000000 +0000
@@ -89,18 +89,18 @@
lets the developer place information in a diagnostic
context that can be subsequently retrieved by certain logback
components. The MDC manages contextual information on
- a per thread basis. A child thread automatically
- inherits a copy of the mapped diagnostic context of its
- parent. Typically, while starting to service a new client request,
- the developer will insert pertinent contextual information, such
- as the client id, client's IP address, request parameters
- etc. into the MDC. Logback components, if
- appropriately configured, will automatically include this
- information in each log entry.
+ a per thread basis. Typically, while starting to service
+ a new client request, the developer will insert pertinent
+ contextual information, such as the client id, client's IP
+ address, request parameters etc. into the
+ MDC. Logback components, if appropriately configured,
+ will automatically include this information in each log entry.
Please note that MDC as implemented by logback-classic assumes
- that values are placed into the MDC with moderate frequency.
+ that values are placed into the MDC with moderate frequency. Also
+ note that a child thread does not automatically inherit a copy of
+ the mapped diagnostic context of its parent.
The next application named
diff -Nru logback-1.1.9/logback-site/src/site/pages/news.html logback-1.2.3/logback-site/src/site/pages/news.html
--- logback-1.1.9/logback-site/src/site/pages/news.html 2017-01-20 18:38:20.000000000 +0000
+++ logback-1.2.3/logback-site/src/site/pages/news.html 2017-04-01 03:14:25.000000000 +0000
@@ -30,11 +30,201 @@
the QOS.ch
announce mailing list.
+
+
-
January 20th, 2017, Release of version 1.1.9
+
March 30th, 2017, Release of version 1.2.3
+
+
Fix unintentional dependency on
+ OutputStreamAppender in
+ LayoutWrappingEncoder as reported in LOGBACK-1287.
+
+
+
Fix spurious System.out.println in AsyncAppender's
+ worker thread. This issue was reported in LOGBACK-1292 by
+ Nikolas Loutas with Thibault Meyer the relevant patch.
+
+
ConsoleAppender exception when run under Java WebStart. This
+ problem was reported in LOGBACK-1282 by
+ Clas Forsberg.
+
+
March 16th, 2017, Release of version 1.2.2
+
+
AsyncAppender no longer drops events when the
+ current thread has its interrupt flag set. This issue was reported
+ in LOGBACK-1247 by
+ Jakob Bergendahl who also provided the relevant pull request.
+
+
+
Removed JMSQueueAppender and
+ JMSTopicAppender. These appenders were undocumented
+ and had no apparent users.
+
+
Remove comment in logback-classic's
+ META-INF/services/javax.servlet.ServletContainerInitializer
+ file in order to keep Wildfly 8 happy. This issue was reported in
+ LOGBACK-1265
+ by Andy Wilkinson.
+
+
+
FileSize.toString() now reports files sizes in GB
+ in addition to sizes in MB and KB and Bytes. This fixes issue LOGBACK-1278.
+
+
+
+
March 1st, 2017, Release of version 1.1.11
+
+
Fix thread-safety issue with PatternLayoutBase
+ reported in LOGBACK-1270 by
+ Artem Bilan. Note that the fix was already present in the 1.2.x
+ series and was back-ported to the 1.1.x series.
+
+
+
+
February 9th, 2017, Release of version 1.2.1
+
+
To ensure backward compatibility of configuration files, the
+ immediateFlush property set for a
+ LayoutWrappingEncoder is propagated to the enclosing
+ OutputStreamAppender.
+
+
+
+
+
February 8th, 2017, Release of version 1.2.0
+
+
+
Encoder interface has changed and is no longer
+ expected to handle an OutputStream.
+
+
+
Encoder interface has changed and is no longer
+ expected to handle an OutputStream. This
+ simplification allows finer-grain locking resulting in significantly
+ improved performance.
+
+
+
Release 1.2.0 fixes a rather severe
+ serialization vulnerability in SocketServer and
+ ServerSocketReceiver. Users running these components
+ should upgrade immediately.
+
+
+
This release fixes a rather severe serialization vulnerability
+ in SocketServer and
+ ServerSocketReceiver. Users running these components
+ should upgrade immediately.
+
+
+
In TimeBasedRollingPolicy, fixed issue with totalSizeCap of more than 2^31. This problem
+ was reported in 1231 by Simon
+ Teng.
+
+
+
Logback-classic now searches for the file
+ logback-test.xml first, logback.groovy second
+ and logback.xml third. In previous versions
+ logback.groovy was looked up first which was non-sensical
+ in presense of logback-test.xml. This fixes LOGBACK-1245
+ reported by Joern Huxhorn.
+
+
+
+
+
+
February 5th, 2017, Release of version 1.1.10
+
+
Several changes to improve throughput (see spreadsheet)
+
+
+
+
The ReentrantLock in
+ OutputStreamAppender is now "unfair". In previous
+ versions of logback, a fair lock was used. Fair locks are much
+ slower. Just as importanly, logback has no mandate to influence
+ thread scheduling.
+
+
+
FileAppender now offers the bufferSize option. Previously, a
+ fixed-size 8K buffer was used. Increasing the bufferSize, for example to 256K,
+ significantly reduces thread-contention.
+
+
+
Critical parts of the code now use
+ COWArrayList, a custom developed allocation-free
+ lock-free thread-safe implementation of the {@link List}
+ interface. It is optimized for cases where iterations over the
+ list vastly outnumber modifications on the list. It is based on
+ CopyOnWriteArrayList but allows allocation-free
+ iterations over the list.
+
+
+
In PatternLayoutBase the same
+ StringBuilder is used over and over to reduce
+ memory allocation. This is safe as long as the owning appender
+ guarantees serial access to its layout. In the next version of
+ logback, i.e. 1.2.x, the read-write lock will no longer protect
+ access to the layout and there will be no guarantee of
+ serial access.
+
+
+
+
In web-applications, logback-classic will automatically
+ install a listener which will stop the logging context and
+ release resources when your web-app is reloaded. This enhancement
+ was requested LOGBACK-1170 by
+ Martin Wegner.
+
+
+
The AccessEvent.prepareForDeferredProcessing()
+ method was not idempotent. This caused subtle bugs under
+ Jetty. See LOGBACK-1189
+ for details. Many thanks to Per Olesen, Evan Meagher, Nick Babcock
+ and Mark Elliot for hunting down this bug.
+
+
+
As it may be time consuming in certain environments, the
+ HOSTNAME property is now computed lazily. This optimization
+ requested in LOGBACK-1221 by
+ Eugene Petrenko.
+
+
+
+
Joran now supports external XML entities. This feature was
+ requested in 1091 and the
+ relevant PR graciously provided by Jonas Neukomm.
+
+
+
+
+
January 20th, 2017, Release of version 1.1.9
Logback's internal executor service had a thread pool size of 2
which could be used up rather quickly, e.g. configuration scanning
diff -Nru logback-1.1.9/logback-site/src/site/pages/setup.html logback-1.2.3/logback-site/src/site/pages/setup.html
--- logback-1.1.9/logback-site/src/site/pages/setup.html 2016-03-31 12:57:56.000000000 +0000
+++ logback-1.2.3/logback-site/src/site/pages/setup.html 2017-03-30 02:48:12.000000000 +0000
@@ -107,6 +107,8 @@
<version>${project.version}</version>
</dependency>
SMTPAppender requires
@@ -257,7 +261,7 @@
Root directory. The import should finish successfully in a few
seconds.
-
Building with Eclipse
+
Building with Eclipse and "mvn eclipse:eclipse"
Building logback under Eclipse is a little trickier. Here are
instructions for building logback under Eclipse using the maven
@@ -276,13 +280,7 @@
-
Install Eclipse
-
-
-
-
Install the Groovy plugin for Eclipse.
+
Ensure that the Groovy plugin for Eclipse is installed.
@@ -297,9 +295,7 @@
In Eclipse, select Help → Intall new Software →
Work with the update site you chose in the previous step and
- then Select "Groovy-Eclipse Feature". Installation of other
- plugins in particular "m2e Configurator for Groovy-Eclipse"
- is not necessary
+ then Select "Groovy-Eclipse Feature".
@@ -318,30 +314,7 @@
In Eclipse, import the logback project: Import→
General→ Existing Projects into Workspace, select
$LOGBACK_HOME folder for the import
-
-
-
-
-
+
In Eclipse, clean all projects in Eclipse (Project →
Clean)
@@ -356,13 +329,90 @@
The above listed procedure has been last tested by the author
- using Eclipse Luna on February 25th, 2016.
+ using Eclipse Neon on March 17th, 2017.
+
+
Building with Eclipse+m2eclipse
+
+
Building with Eclipse and m2eclipse is a bit more complicated
+ due to the use of Groovy in logback-classic.
+
+
+
Here are the required steps:
+
+
+
+
Ensure that the Groovy plugin for Eclipse is installed. See
+ above for instructions.
+
+
In Eclipse, import the logback project: Import→
+ Maven→ Existing Maven Projects, select
+ $LOGBACK_HOME folder for the import
+
+
+
Install any discovered m2e connections,
+ e.g. "maven-bundle-plugin".
+
In Eclipse, select logback-classic project and check that it
+ has "Groovy" nature. If not add it by right clicking on
+ logback-classic project → Groovy → Convert Groovy to
+ Project.
+
+
+
At this stage Eclipse may complain about
+ GafferConfigurator not being resolved. To fix these
+ errors, select logback-classic project properties, select "Java
+ Build Path" → Source → "logback-classic/src/main/groovy".
+ Select "Excluded" and then click on Remove.
+
+
To fix the errors in the logback-examples project, you need
+ to instruct logback-classic to not export its Maven dependencies.
+ Select logback-classic project properties, select "Java
+ Build Path" → Order and Export and deselect "Maven Dependencies".
+
+
Call for volunteers Given that many
- users prefer M2Eclipse for building projects under Eclipse IDE, we
- are looking for volunteers to help work out the steps for building
- logback with M2Eclipse.
+
Call for volunteers Given that
+ many users prefer M2Eclipse for building projects under Eclipse
+ IDE, we are looking for volunteers to help simplify the steps
+ required for building logback with M2Eclipse.
');
Binary files /tmp/tmp_w3zLB/z9ana35gcZ/logback-1.1.9/logback-site/src/site/resources/images/setup/deselectMavenDependenciesExport.png and /tmp/tmp_w3zLB/lmaIvID0_A/logback-1.2.3/logback-site/src/site/resources/images/setup/deselectMavenDependenciesExport.png differ
Binary files /tmp/tmp_w3zLB/z9ana35gcZ/logback-1.1.9/logback-site/src/site/resources/images/setup/discoverM2EConnectors.png and /tmp/tmp_w3zLB/lmaIvID0_A/logback-1.2.3/logback-site/src/site/resources/images/setup/discoverM2EConnectors.png differ
Binary files /tmp/tmp_w3zLB/z9ana35gcZ/logback-1.1.9/logback-site/src/site/resources/images/setup/removeGroovyExclusions.png and /tmp/tmp_w3zLB/lmaIvID0_A/logback-1.2.3/logback-site/src/site/resources/images/setup/removeGroovyExclusions.png differ
diff -Nru logback-1.1.9/pom.xml logback-1.2.3/pom.xml
--- logback-1.1.9/pom.xml 2017-01-20 18:48:32.000000000 +0000
+++ logback-1.2.3/pom.xml 2017-04-01 03:15:20.000000000 +0000
@@ -1,3 +1,4 @@
+
@@ -6,7 +7,7 @@
ch.qos.logbacklogback-parent
- 1.1.9
+ 1.2.3pomLogback-Parent
@@ -51,19 +52,23 @@
UTF-84.101.4
- 2.7.8
+ 3.0.62.4.0
- 1.7.22
+ 1.7.25
+ 0.8.11.1.0
- 7.0.59
- 7.5.1.v20110908
+
+ 8.5.9
+
+ 8.2.0.v20160908
+
1.9
- 2.9.1
- 2.6
- 1.9.0
+ 2.10.4
+ 2.7
+ 3.0
@@ -152,9 +157,9 @@
1.6.1
- hsqldb
+ org.hsqldbhsqldb
- 1.8.0.7
+ 2.3.4com.h2database
@@ -186,21 +191,24 @@
jetty-server${jetty.version}
-
- org.apache.geronimo.specs
- geronimo-jms_1.1_spec
- 1.0
-
+
javax.servlet
- servlet-api
- 2.5
+ javax.servlet-api
+ 3.1.0
+
joda-timejoda-time2.9.2
+
+
+ org.mockito
+ mockito-core
+ 2.7.9
+
@@ -210,7 +218,7 @@
org.apache.maven.wagonwagon-ssh
- 2.8
+ 2.10
@@ -219,12 +227,12 @@
org.apache.maven.pluginsmaven-clean-plugin
- 2.6.1
+ 3.0.0org.apache.maven.pluginsmaven-compiler-plugin
- 3.5.1
+ 3.6.0org.apache.maven.plugins
@@ -239,12 +247,12 @@
org.apache.maven.pluginsmaven-resources-plugin
- 2.6
+ 3.0.1org.apache.maven.pluginsmaven-site-plugin
- 3.4
+ 3.6org.apache.maven.plugins
@@ -254,7 +262,7 @@
org.apache.maven.pluginsmaven-jar-plugin
- 2.5
+ 2.6org.apache.maven.plugins
@@ -269,28 +277,28 @@
org.apache.maven.pluginsmaven-release-plugin
- 2.5.1
+ 2.5.3org.apache.maven.pluginsmaven-source-plugin
- 2.4
+ 3.0.1org.codehaus.mojofindbugs-maven-plugin
- 3.0.0
+ 3.0.4org.apache.felixmaven-bundle-plugin
- 2.5.3
+ 2.5.4org.codehaus.mojoanimal-sniffer-maven-plugin
- 1.14
+ 1.15sun.reflect.Reflection
@@ -325,7 +333,7 @@
org.apache.maven.pluginsmaven-assembly-plugin
- 2.5.3
+ 3.0.0src/main/assembly/dist.xml
@@ -370,7 +378,7 @@
org.apache.maven.pluginsmaven-javadoc-plugin
- 2.10.1
+ 2.10.4truetrue
@@ -440,9 +448,9 @@
- com.mycila.maven-license-plugin
- maven-license-plugin
- 1.9.0
+ com.mycila
+ license-maven-plugin
+ ${maven-license-plugin.version}src/main/licenseHeader.txtfalse
diff -Nru logback-1.1.9/README.md logback-1.2.3/README.md
--- logback-1.1.9/README.md 1970-01-01 00:00:00.000000000 +0000
+++ logback-1.2.3/README.md 2017-03-30 02:48:09.000000000 +0000
@@ -0,0 +1,57 @@
+
+#About logback
+
+Thank you for your interest in logback, the reliable, generic, fast
+and flexible logging library for Java.
+
+The Logback documentation can be found on the [project
+web-site](https://logback.qos.ch/documentation.html) as well as under
+the docs/ folder of the logback distribution.
+
+#Building logback
+
+Building logback is documented at:
+
+ https://logback.qos.ch/setup.html#ide
+
+#In case of problems
+
+In case of problems please do not hesitate to post an e-mail message
+on the logback-user@qos.ch mailing list. However, please do not
+directly e-mail logback developers. The answer to your question might
+be useful to other users. Moreover, there are many knowledgeable users
+on the logback-user mailing lists who can quickly answer your
+questions.
+
+
+#Pull requests
+
+If you are interested in improving logback, great! The logback community
+looks forward to your contribution. Please follow this process:
+
+1. Please file a [bug
+ report](https://logback.qos.ch/bugreport.html). Pull requests with
+ an associated JIRA issue will get more attention.
+
+ Optional: Start a discussion on the [logback-dev mailing
+ list](https://logback.qos.ch/mailinglist.html) about your proposed
+ change.
+
+2. Fork qos-ch/logback. Ideally, create a new branch from your fork for
+ your contribution to make it easier to merge your changes back.
+
+3. Make your changes on the branch you hopefuly created in Step 2. Be
+ sure that your code passes existing unit tests.
+
+4. Please add unit tests for your work if appropriate. It usually is.
+
+5. Push your changes to your fork/branch in github. Don't push it to
+ your master! If you do it will make it harder to submit new changes
+ later.
+
+6. Submit a pull request to logback from from your commit page on
+ github.
+
+
+# Build Status
+[![Build Status](https://travis-ci.org/qos-ch/slf4j.png)](https://travis-ci.org/qos-ch/slf4j)
diff -Nru logback-1.1.9/README.txt logback-1.2.3/README.txt
--- logback-1.1.9/README.txt 2016-12-09 11:57:44.000000000 +0000
+++ logback-1.2.3/README.txt 1970-01-01 00:00:00.000000000 +0000
@@ -1,21 +0,0 @@
-Thank you for downloading logback, the reliable, generic, fast and
-flexible logging library for Java.
-
-The Logback documentation can be found under the docs/ directory.
-
-Building logback
-================
-
-Building logback is documented at:
-
- http://logback.qos.ch/setup.html#ide
-
-In case of problems
-===================
-
-In case of problems please do not hesitate to post an e-mail message
-on the logback-user@qos.ch mailing list. However, please do not
-directly e-mail logback developers. The answer to your question might
-be useful to other users. Moreover, there are many knowledgeable users
-on the logback-user mailing lists who can quickly answer your
-questions.
diff -Nru logback-1.1.9/src/main/assembly/dist.xml logback-1.2.3/src/main/assembly/dist.xml
--- logback-1.1.9/src/main/assembly/dist.xml 2016-12-12 12:17:38.000000000 +0000
+++ logback-1.2.3/src/main/assembly/dist.xml 2017-03-30 02:48:12.000000000 +0000
@@ -136,21 +136,21 @@
logback-core/target/
- /
+ ./logback-core-${project.version}.jarlogback-classic/target/
- /
+ ./logback-classic-${project.version}.jarlogback-access/target/
- /
+ ./logback-access-${project.version}.jar
@@ -158,21 +158,21 @@
logback-core/target/
- /
+ ./logback-core-${project.version}-sources.jarlogback-classic/target/
- /
+ ./logback-classic-${project.version}-sources.jarlogback-access/target/
- /
+ ./logback-access-${project.version}-sources.jar
diff -Nru logback-1.1.9/src/main/clas/signed-clas.txt logback-1.2.3/src/main/clas/signed-clas.txt
--- logback-1.1.9/src/main/clas/signed-clas.txt 2017-01-06 21:15:01.000000000 +0000
+++ logback-1.2.3/src/main/clas/signed-clas.txt 2017-03-30 02:48:12.000000000 +0000
@@ -51,6 +51,8 @@
Kenneth Gendron CA, USA 2016-04-01
Espen A. Fossen Norway 2016-04-07
Scott Babcock WA, USA 2016-12-22
+Olivier Bourgain France 2017-01-31
+Nicolas Maupu France 2017-01-31
Justification for CLAs
----------------------