logback-dev
Threads by month
- ----- 2025 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
November 2011
- 9 participants
- 105 discussions

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-29-g1cc6703
by git-noreply@pixie.qos.ch 07 Nov '11
by git-noreply@pixie.qos.ch 07 Nov '11
07 Nov '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 1cc67039562ac28b9c85e2c9e41269703780f99d (commit)
from 8bf8416306b4831c65ad74c9d6e947173c253a51 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=1cc67039562ac28b9c85e2c9…
http://github.com/ceki/logback/commit/1cc67039562ac28b9c85e2c9e41269703780f…
commit 1cc67039562ac28b9c85e2c9e41269703780f99d
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Nov 7 20:56:32 2011 +0100
added getCallerLinePrefix method in response to LBCORE-233
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/CallerDataConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/CallerDataConverter.java
index fc280b6..81bc67e 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/CallerDataConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/CallerDataConverter.java
@@ -32,9 +32,12 @@ import ch.qos.logback.core.status.ErrorStatus;
*/
public class CallerDataConverter extends ClassicConverter {
+ public static final String DEFAULT_CALLER_LINE_PREFIX = "Caller+";
+
int depth = 5;
List<EventEvaluator<ILoggingEvent>> evaluatorList = null;
+
final int MAX_ERROR_COUNT = 4;
int errorCount = 0;
@@ -118,7 +121,7 @@ public class CallerDataConverter extends ClassicConverter {
int limit = depth < cda.length ? depth : cda.length;
for (int i = 0; i < limit; i++) {
- buf.append("Caller+");
+ buf.append(getCallerLinePrefix());
buf.append(i);
buf.append("\t at ");
buf.append(cda[i]);
@@ -129,4 +132,8 @@ public class CallerDataConverter extends ClassicConverter {
return CallerData.CALLER_DATA_NA;
}
}
+
+ protected String getCallerLinePrefix() {
+ return DEFAULT_CALLER_LINE_PREFIX;
+ }
}
-----------------------------------------------------------------------
Summary of changes:
.../classic/pattern/CallerDataConverter.java | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-28-g8bf8416
by git-noreply@pixie.qos.ch 07 Nov '11
by git-noreply@pixie.qos.ch 07 Nov '11
07 Nov '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 8bf8416306b4831c65ad74c9d6e947173c253a51 (commit)
from 7f35c6f1e7ddab9baac0e71de1c9e251844658d8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=8bf8416306b4831c65ad74c9…
http://github.com/ceki/logback/commit/8bf8416306b4831c65ad74c9d6e947173c253…
commit 8bf8416306b4831c65ad74c9d6e947173c253a51
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Nov 7 20:51:13 2011 +0100
in response to LBCORE-233 added locationAwareLoggerIntegerToLevel method in Level class
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Level.java b/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
index 88cb247..e46393c 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
@@ -13,6 +13,8 @@
*/
package ch.qos.logback.classic;
+import org.slf4j.spi.LocationAwareLogger;
+
/**
* Defines the set of levels recognized by logback-classic, that is {@link #OFF},
* {@link #ERROR}, {@link #WARN}, {@link #INFO}, {@link #DEBUG},
@@ -91,6 +93,38 @@ public final class Level implements java.io.Serializable {
}
/**
+ * Convert one of the integer values defined in {@link LocationAwareLogger}
+ * interface to an instance of this class, i.e. a Level.
+ * @param levelInt An integer value representing a level as defined in LocationAwareLogger
+ * @return an instance of this class, i.e. a Level.
+ *
+ * @since 1.0.1
+ */
+ public static Level locationAwareLoggerIntegerToLevel(int levelInt) {
+ Level level;
+ switch (levelInt) {
+ case LocationAwareLogger.TRACE_INT:
+ level = TRACE;
+ break;
+ case LocationAwareLogger.DEBUG_INT:
+ level = DEBUG;
+ break;
+ case LocationAwareLogger.INFO_INT:
+ level = INFO;
+ break;
+ case LocationAwareLogger.WARN_INT:
+ level = WARN;
+ break;
+ case LocationAwareLogger.ERROR_INT:
+ level = ERROR;
+ break;
+ default:
+ throw new IllegalArgumentException(levelInt + " not a valid level value");
+ }
+ return level;
+ }
+
+ /**
* Returns the string representation of this Level.
*/
public final String toString() {
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
index 0e2c77b..500a9d3 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
@@ -821,25 +821,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
public void log(Marker marker, String fqcn, int levelInt, String message,
Object[] argArray, Throwable t) {
Level level = null;
- switch (levelInt) {
- case LocationAwareLogger.TRACE_INT:
- level = Level.TRACE;
- break;
- case LocationAwareLogger.DEBUG_INT:
- level = Level.DEBUG;
- break;
- case LocationAwareLogger.INFO_INT:
- level = Level.INFO;
- break;
- case LocationAwareLogger.WARN_INT:
- level = Level.WARN;
- break;
- case LocationAwareLogger.ERROR_INT:
- level = Level.ERROR;
- break;
- default:
- throw new IllegalArgumentException(levelInt + " not a valid level value");
- }
+ level = Level.locationAwareLoggerIntegerToLevel(levelInt);
filterAndLog_0_Or3Plus(fqcn, marker, level, message, argArray, t);
}
-----------------------------------------------------------------------
Summary of changes:
.../main/java/ch/qos/logback/classic/Level.java | 34 ++++++++++++++++++++
.../main/java/ch/qos/logback/classic/Logger.java | 20 +-----------
2 files changed, 35 insertions(+), 19 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-27-g7f35c6f
by git-noreply@pixie.qos.ch 07 Nov '11
by git-noreply@pixie.qos.ch 07 Nov '11
07 Nov '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 7f35c6f1e7ddab9baac0e71de1c9e251844658d8 (commit)
via c93e406306c1eba98848f136a031447ca70ddaf0 (commit)
from df32ded547dac8d53dfe0f3d8364efad1bc54f82 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=7f35c6f1e7ddab9baac0e71d…
http://github.com/ceki/logback/commit/7f35c6f1e7ddab9baac0e71de1c9e25184465…
commit 7f35c6f1e7ddab9baac0e71de1c9e251844658d8
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Nov 7 16:20:19 2011 +0100
Using entrySet instead of keySet for performance.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java
index 468f43e..4174215 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java
@@ -51,18 +51,15 @@ public class MDCConverter extends ClassicConverter {
// if no key is specified, return all the
// values present in the MDC, separated with a single space.
StringBuilder buf = new StringBuilder();
- Set<String> keys = mdcPropertyMap.keySet();
- Iterator it = keys.iterator();
- String tmpKey;
- String tmpValue;
- while (it.hasNext()) {
- tmpKey = (String)it.next();
- tmpValue = (String)mdcPropertyMap.get(tmpKey);
- //format: {testeKey=testValue, testKey2=testValue2}
- buf.append(tmpKey).append('=').append(tmpValue);
- if (it.hasNext()) {
+ boolean first = true;
+ for(Map.Entry<String, String> entry : mdcPropertyMap.entrySet()) {
+ if(first) {
+ first = false;
+ } else {
buf.append(", ");
}
+ //format: {testKey=testValue, testKey2=testValue2}
+ buf.append(entry.getKey()).append('=').append(entry.getValue());
}
return buf.toString();
}
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=c93e406306c1eba98848f136…
http://github.com/ceki/logback/commit/c93e406306c1eba98848f136a031447ca70dd…
commit c93e406306c1eba98848f136a031447ca70ddaf0
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Nov 7 16:08:33 2011 +0100
Removing duplicate code in switch.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/LevelToSyslogSeverity.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/LevelToSyslogSeverity.java
index e627335..05df1ef 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/LevelToSyslogSeverity.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/LevelToSyslogSeverity.java
@@ -36,7 +36,6 @@ public class LevelToSyslogSeverity {
case Level.INFO_INT:
return SyslogConstants.INFO_SEVERITY;
case Level.DEBUG_INT:
- return SyslogConstants.DEBUG_SEVERITY;
case Level.TRACE_INT:
return SyslogConstants.DEBUG_SEVERITY;
default:
diff --git a/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/OptionTokenizer.java b/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/OptionTokenizer.java
index 25e89d5..6af4f62 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/OptionTokenizer.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/pattern/parser/OptionTokenizer.java
@@ -69,7 +69,6 @@ public class OptionTokenizer {
case '\t':
case '\r':
case '\n':
- break;
case COMMA_CHAR:
break;
case SINGLE_QUOTE_CHAR:
@@ -145,4 +144,4 @@ public class OptionTokenizer {
escapeUtil.escape(escapeChars, buf, next, tokenStream.pointer);
}
}
-}
\ No newline at end of file
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/SequenceToRegex4SDF.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/SequenceToRegex4SDF.java
index a63b22e..4842d1e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/SequenceToRegex4SDF.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/SequenceToRegex4SDF.java
@@ -36,6 +36,7 @@ class SequenceToRegex4SDF {
String toRegex() {
switch (c) {
case 'G':
+ case 'z':
return ".*";
case 'M':
if (occurrences >= 3) {
@@ -61,8 +62,6 @@ class SequenceToRegex4SDF {
return ".{2,12}";
case 'a':
return ".{2}";
- case 'z':
- return ".*";
case 'Z':
return "(\\+|-)\\d{4}";
case '.':
-----------------------------------------------------------------------
Summary of changes:
.../qos/logback/classic/pattern/MDCConverter.java | 17 +++++++----------
.../classic/util/LevelToSyslogSeverity.java | 1 -
.../core/pattern/parser/OptionTokenizer.java | 3 +--
.../core/rolling/helper/SequenceToRegex4SDF.java | 3 +--
4 files changed, 9 insertions(+), 15 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-25-gdf32ded
by git-noreply@pixie.qos.ch 07 Nov '11
by git-noreply@pixie.qos.ch 07 Nov '11
07 Nov '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via df32ded547dac8d53dfe0f3d8364efad1bc54f82 (commit)
via c01164b75f63aa0e7fe68fae2ecaad7998a2018a (commit)
via 75c52a57a9dbc341d0b3db9ec269e2d1d8933712 (commit)
via 7136a755491b3f78c00393d5d0267026208d86b5 (commit)
via 941995a3fe47db831059c48e212e007ab6f0d00c (commit)
via 5018a1359e255517e316e6b3b7f8f931ccd49e1d (commit)
via 9e6ef7433b9d8cc8489f5d3fc34ec500728d3925 (commit)
via 0d57c38a28952dbb03f87784390986b64e9aaf45 (commit)
via 9982b65e6effe0910c81848db2dc5da70821c9f7 (commit)
via c634320ef70225e0a467283461a15040afc6a6c2 (commit)
via 6f64b161569ae15a7acfe744a10d3157743a2d40 (commit)
from c8ba2fe56d8365b5062e080de71363679c3bd3d0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=df32ded547dac8d53dfe0f3d…
http://github.com/ceki/logback/commit/df32ded547dac8d53dfe0f3d8364efad1bc54…
commit df32ded547dac8d53dfe0f3d8364efad1bc54f82
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Nov 7 14:15:28 2011 +0100
Modifier order.
diff --git a/logback-access/src/main/java/ch/qos/logback/access/AccessConstants.java b/logback-access/src/main/java/ch/qos/logback/access/AccessConstants.java
index fc619ef..30e20fc 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/AccessConstants.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/AccessConstants.java
@@ -15,21 +15,18 @@ package ch.qos.logback.access;
public class AccessConstants {
- public final static String LOGBACK_STATUS_MANAGER_KEY = "LOGBACK_STATUS_MANAGER";
+ public static final String LOGBACK_STATUS_MANAGER_KEY = "LOGBACK_STATUS_MANAGER";
public static final String LB_INPUT_BUFFER = "LB_INPUT_BUFFER";
public static final String LB_OUTPUT_BUFFER = "LB_OUTPUT_BUFFER";
- public final static String X_WWW_FORM_URLECODED = "application/x-www-form-urlencoded";
+ public static final String X_WWW_FORM_URLECODED = "application/x-www-form-urlencoded";
- public final static String IMAGE_CONTENT_TYPE = "image/";
- public final static String IMAGE_JPEG = "image/jpeg";
- public final static String IMAGE_GIF = "image/gif";
- public final static String IMAGE_PNG = "image/png";
+ public static final String IMAGE_CONTENT_TYPE = "image/";
+ public static final String IMAGE_JPEG = "image/jpeg";
+ public static final String IMAGE_GIF = "image/gif";
+ public static final String IMAGE_PNG = "image/png";
-
-
-
- public final static String TEE_FILTER_INCLUDES_PARAM = "includes";
- public final static String TEE_FILTER_EXCLUDES_PARAM = "excludes";
+ public static final String TEE_FILTER_INCLUDES_PARAM = "includes";
+ public static final String TEE_FILTER_EXCLUDES_PARAM = "excludes";
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java b/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java
index aefaa43..46e17fa 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/ClassicConstants.java
@@ -17,7 +17,7 @@ import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
public class ClassicConstants {
- static public final String USER_MDC_KEY = "user";
+ public static final String USER_MDC_KEY = "user";
public static final String LOGBACK_CONTEXT_SELECTOR = "logback.ContextSelector";
public static final String JNDI_CONFIGURATION_RESOURCE = "java:comp/env/logback/configuration-resource";
@@ -36,14 +36,14 @@ public class ClassicConstants {
*/
public static final int DEFAULT_MAX_CALLEDER_DATA_DEPTH = 8;
- public final static String REQUEST_REMOTE_HOST_MDC_KEY = "req.remoteHost";
- public final static String REQUEST_USER_AGENT_MDC_KEY = "req.userAgent";
- public final static String REQUEST_REQUEST_URI = "req.requestURI";
- public final static String REQUEST_QUERY_STRING = "req.queryString";
- public final static String REQUEST_REQUEST_URL = "req.requestURL";
- public final static String REQUEST_X_FORWARDED_FOR = "req.xForwardedFor";
+ public static final String REQUEST_REMOTE_HOST_MDC_KEY = "req.remoteHost";
+ public static final String REQUEST_USER_AGENT_MDC_KEY = "req.userAgent";
+ public static final String REQUEST_REQUEST_URI = "req.requestURI";
+ public static final String REQUEST_QUERY_STRING = "req.queryString";
+ public static final String REQUEST_REQUEST_URL = "req.requestURL";
+ public static final String REQUEST_X_FORWARDED_FOR = "req.xForwardedFor";
- public final static String GAFFER_CONFIGURATOR_FQCN = "ch.qos.logback.classic.gaffer.GafferConfigurator";
+ public static final String GAFFER_CONFIGURATOR_FQCN = "ch.qos.logback.classic.gaffer.GafferConfigurator";
- public final static Marker FINALIZE_SESSION_MARKER = MarkerFactory.getMarker("FINALIZE_SESSION");
+ public static final Marker FINALIZE_SESSION_MARKER = MarkerFactory.getMarker("FINALIZE_SESSION");
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
index 7acb1aa..0e2c77b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
@@ -378,7 +378,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
* The default size of child list arrays. The JDK 1.5 default is 10. We use a
* smaller value to save a little space.
*/
- static private final int DEFAULT_CHILD_ARRAY_SIZE = 5;
+ private static final int DEFAULT_CHILD_ARRAY_SIZE = 5;
Logger createChildByName(final String childName) {
int i_index = getSeparatorIndexOf(childName, this.name.length() + 1);
@@ -510,11 +510,11 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
filterAndLog_0_Or3Plus(FQCN, marker, Level.TRACE, msg, null, t);
}
- final public boolean isDebugEnabled() {
+ public final boolean isDebugEnabled() {
return isDebugEnabled(null);
}
- final public boolean isDebugEnabled(Marker marker) {
+ public final boolean isDebugEnabled(Marker marker) {
final FilterReply decision = callTurboFilters(marker, Level.DEBUG);
if (decision == FilterReply.NEUTRAL) {
return effectiveLevelInt <= Level.DEBUG_INT;
@@ -527,19 +527,19 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
}
}
- final public void debug(String msg) {
+ public final void debug(String msg) {
filterAndLog_0_Or3Plus(FQCN, null, Level.DEBUG, msg, null, null);
}
- final public void debug(String format, Object arg) {
+ public final void debug(String format, Object arg) {
filterAndLog_1(FQCN, null, Level.DEBUG, format, arg, null);
}
- final public void debug(String format, Object arg1, Object arg2) {
+ public final void debug(String format, Object arg1, Object arg2) {
filterAndLog_2(FQCN, null, Level.DEBUG, format, arg1, arg2, null);
}
- final public void debug(String format, Object[] argArray) {
+ public final void debug(String format, Object[] argArray) {
filterAndLog_0_Or3Plus(FQCN, null, Level.DEBUG, format, argArray, null);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java b/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
index 55fb8e4..713879d 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java
@@ -40,38 +40,38 @@ public class CoreConstants {
/**
* Time format used in Common Log Format
*/
- static public final String CLF_DATE_PATTERN = "dd/MM/yyyy:HH:mm:ss Z";
+ public static final String CLF_DATE_PATTERN = "dd/MM/yyyy:HH:mm:ss Z";
/**
* The key used in locating the evaluator map in context's object map.
*/
- static public final String EVALUATOR_MAP = "EVALUATOR_MAP";
+ public static final String EVALUATOR_MAP = "EVALUATOR_MAP";
/**
* By convention, we assume that the static method named "valueOf" taking
* a string argument can restore a given object from its string
* representation.
*/
- static public final String VALUE_OF = "valueOf";
+ public static final String VALUE_OF = "valueOf";
/**
* An empty string.
*/
- public final static String EMPTY_STRING = "";
+ public static final String EMPTY_STRING = "";
/**
* An empty string array.
*/
- public final static String[] EMPTY_STRING_ARRAY = new String[]{};
+ public static final String[] EMPTY_STRING_ARRAY = new String[]{};
/**
* An empty Class array.
*/
- public final static Class<?>[] EMPTY_CLASS_ARRAY = new Class[]{};
- public final static String CAUSED_BY = "Caused by: ";
- public final static String WRAPPED_BY = "Wrapped by: ";
+ public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[]{};
+ public static final String CAUSED_BY = "Caused by: ";
+ public static final String WRAPPED_BY = "Wrapped by: ";
- public final static char PERCENT_CHAR = '%';
+ public static final char PERCENT_CHAR = '%';
public static final char LEFT_PARENTHESIS_CHAR = '(';
public static final char RIGHT_PARENTHESIS_CHAR = ')';
@@ -101,20 +101,20 @@ public class CoreConstants {
// the max number of times an error should be reported
- static public final int MAX_ERROR_COUNT = 4;
+ public static final int MAX_ERROR_COUNT = 4;
- static public final char DOT = '.';
- static public final char TAB = '\t';
- static public final char DOLLAR = '$';
+ public static final char DOT = '.';
+ public static final char TAB = '\t';
+ public static final char DOLLAR = '$';
- static public final String SEE_FNP_NOT_SET = "See also http://logback.qos.ch/codes.html#tbr_fnp_not_set";
+ public static final String SEE_FNP_NOT_SET = "See also http://logback.qos.ch/codes.html#tbr_fnp_not_set";
- static public final String CONFIGURATION_WATCH_LIST = "CONFIGURATION_WATCH_LIST";
- static public final String CONFIGURATION_WATCH_LIST_RESET = "CONFIGURATION_WATCH_LIST_RESET";
+ public static final String CONFIGURATION_WATCH_LIST = "CONFIGURATION_WATCH_LIST";
+ public static final String CONFIGURATION_WATCH_LIST_RESET = "CONFIGURATION_WATCH_LIST_RESET";
- static public final String SAFE_JORAN_CONFIGURATION = "SAFE_JORAN_CONFIGURATION";
- static public final String XML_PARSING = "XML_PARSING";
+ public static final String SAFE_JORAN_CONFIGURATION = "SAFE_JORAN_CONFIGURATION";
+ public static final String XML_PARSING = "XML_PARSING";
@@ -140,5 +140,5 @@ public class CoreConstants {
public static final String CONTEXT_SCOPE_VALUE = "context";
- final public static String RESET_MSG_PREFIX = "Will reset and reconfigure context ";
+ public static final String RESET_MSG_PREFIX = "Will reset and reconfigure context ";
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java b/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java
index a93d371..e7f5330 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/GenericConfigurator.java
@@ -43,7 +43,7 @@ public abstract class GenericConfigurator extends ContextAwareBase {
protected Interpreter interpreter;
- final public void doConfigure(URL url) throws JoranException {
+ public final void doConfigure(URL url) throws JoranException {
try {
informContextOfURLUsedForConfiguration(getContext(), url);
URLConnection urlConnection = url.openConnection();
@@ -61,11 +61,11 @@ public abstract class GenericConfigurator extends ContextAwareBase {
}
}
- final public void doConfigure(String filename) throws JoranException {
+ public final void doConfigure(String filename) throws JoranException {
doConfigure(new File(filename));
}
- final public void doConfigure(File file) throws JoranException {
+ public final void doConfigure(File file) throws JoranException {
FileInputStream fis = null;
try {
informContextOfURLUsedForConfiguration(getContext(), file.toURI().toURL());
@@ -88,17 +88,17 @@ public abstract class GenericConfigurator extends ContextAwareBase {
}
}
- static public void informContextOfURLUsedForConfiguration(Context context, URL url) {
+ public static void informContextOfURLUsedForConfiguration(Context context, URL url) {
ConfigurationWatchListUtil.setMainWatchURL(context, url);
}
- final public void doConfigure(InputStream inputStream) throws JoranException {
+ public final void doConfigure(InputStream inputStream) throws JoranException {
doConfigure(new InputSource(inputStream));
}
- abstract protected void addInstanceRules(RuleStore rs);
+ protected abstract void addInstanceRules(RuleStore rs);
- abstract protected void addImplicitRules(Interpreter interpreter);
+ protected abstract void addImplicitRules(Interpreter interpreter);
protected void addDefaultNestedComponentRegistryRules(DefaultNestedComponentRegistry registry) {
@@ -120,7 +120,7 @@ public abstract class GenericConfigurator extends ContextAwareBase {
// this is the most inner form of doConfigure whereto other doConfigure
// methods ultimately delegate
- final public void doConfigure(final InputSource inputSource)
+ public final void doConfigure(final InputSource inputSource)
throws JoranException {
long threshold = System.currentTimeMillis();
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=c01164b75f63aa0e7fe68fae…
http://github.com/ceki/logback/commit/c01164b75f63aa0e7fe68fae2ecaad7998a20…
commit c01164b75f63aa0e7fe68fae2ecaad7998a2018a
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Nov 7 13:50:48 2011 +0100
Using StringBuilder in loops.
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java
index ec020a9..cb95048 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java
@@ -237,11 +237,10 @@ public class Pattern {
@Override
public String toString() {
- int size = partList.size();
- String result = "";
- for (int i = 0; i < size; i++) {
- result += "[" + partList.get(i) + "]";
+ StringBuilder result = new StringBuilder();
+ for (String current : partList) {
+ result.append("[").append(current).append("]");
}
- return result;
+ return result.toString();
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/pattern/util/RegularEscapeUtil.java b/logback-core/src/main/java/ch/qos/logback/core/pattern/util/RegularEscapeUtil.java
index b984d99..b4e2a0f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/pattern/util/RegularEscapeUtil.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/pattern/util/RegularEscapeUtil.java
@@ -50,11 +50,11 @@ public class RegularEscapeUtil implements IEscapeUtil {
}
String formatEscapeCharsForListing(String escapeChars) {
- String commaSeperatedEscapeChars = "";
+ StringBuilder commaSeperatedEscapeChars = new StringBuilder();
for (int i = 0; i < escapeChars.length(); i++) {
- commaSeperatedEscapeChars += ", \\" + escapeChars.charAt(i);
+ commaSeperatedEscapeChars.append(", \\").append(escapeChars.charAt(i));
}
- return commaSeperatedEscapeChars;
+ return commaSeperatedEscapeChars.toString();
}
public static String basicEscape(String s) {
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=75c52a57a9dbc341d0b3db9e…
http://github.com/ceki/logback/commit/75c52a57a9dbc341d0b3db9ec269e2d1d8933…
commit 75c52a57a9dbc341d0b3db9ec269e2d1d8933712
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Nov 7 13:42:19 2011 +0100
Preventing possible NPE.
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java
index a0b7d1d..ee1620a 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Interpreter.java
@@ -167,14 +167,14 @@ public class Interpreter {
setDocumentLocator(be.locator);
String body = be.getText();
- List applicableActionList = (List) actionListStack.peek();
+ List applicableActionList = actionListStack.peek();
if (body != null) {
body = body.trim();
- }
- if (body.length() > 0) {
- // System.out.println("calling body method with ["+body+ "]");
- callBodyAction(applicableActionList, body);
+ if (body.length() > 0) {
+ // System.out.println("calling body method with ["+body+ "]");
+ callBodyAction(applicableActionList, body);
+ }
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
index 3319419..a38777f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
@@ -81,7 +81,10 @@ public abstract class SyslogAppenderBase<E> extends AppenderBase<E> {
try {
String msg = layout.doLayout(eventObject);
- if (msg != null && msg.length() > MSG_SIZE_LIMIT) {
+ if(msg == null) {
+ return;
+ }
+ if (msg.length() > MSG_SIZE_LIMIT) {
msg = msg.substring(0, MSG_SIZE_LIMIT);
}
sos.write(msg.getBytes());
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=7136a755491b3f78c00393d5…
http://github.com/ceki/logback/commit/7136a755491b3f78c00393d5d0267026208d8…
commit 7136a755491b3f78c00393d5d0267026208d86b5
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Nov 7 13:38:08 2011 +0100
Removing dead stores to local variables.
diff --git a/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java b/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
index 78c825c..3008d70 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/db/DBAppender.java
@@ -130,7 +130,6 @@ public class DBAppender extends DBAppenderBase<IAccessEvent> {
}
insertHeaderStatement.close();
- insertHeaderStatement = null;
}
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
index eedc1e6..5842d93 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/db/DBAppender.java
@@ -229,7 +229,6 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
}
insertPropertiesStatement.close();
- insertPropertiesStatement = null;
}
}
@@ -296,7 +295,5 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
exceptionStatement.executeBatch();
}
exceptionStatement.close();
- exceptionStatement = null;
-
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
index fe427f5..794e1d7 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DBAppenderBase.java
@@ -112,7 +112,6 @@ public abstract class DBAppenderBase<E> extends UnsynchronizedAppenderBase<E> {
// we no longer need the insertStatement
close(insertStatement);
- insertStatement = null;
connection.commit();
} catch (Throwable sqle) {
@@ -166,7 +165,6 @@ public abstract class DBAppenderBase<E> extends UnsynchronizedAppenderBase<E> {
rs.close();
close(idStatement);
- idStatement = null;
return eventId;
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java
index ec189a9..371b0d8 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/TimestampAction.java
@@ -51,7 +51,7 @@ public class TimestampAction extends Action {
}
String timeReferenceStr = attributes.getValue(TIME_REFERENCE_ATTRIBUTE);
- long timeReference = -1;
+ long timeReference;
if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) {
addInfo("Using context birth as time reference.");
timeReference = context.getBirthTime();
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=941995a3fe47db831059c48e…
http://github.com/ceki/logback/commit/941995a3fe47db831059c48e212e007ab6f0d…
commit 941995a3fe47db831059c48e212e007ab6f0d00c
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Nov 7 13:26:42 2011 +0100
Use boxing instead of c'tors.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Level.java b/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
index 6e77220..88cb247 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Level.java
@@ -32,13 +32,13 @@ public final class Level implements java.io.Serializable {
public static final int TRACE_INT = 5000;
public static final int ALL_INT = Integer.MIN_VALUE;
- public static final Integer OFF_INTEGER = new Integer(OFF_INT);
- public static final Integer ERROR_INTEGER = new Integer(ERROR_INT);
- public static final Integer WARN_INTEGER = new Integer(WARN_INT);
- public static final Integer INFO_INTEGER = new Integer(INFO_INT);
- public static final Integer DEBUG_INTEGER = new Integer(DEBUG_INT);
- public static final Integer TRACE_INTEGER = new Integer(TRACE_INT);
- public static final Integer ALL_INTEGER = new Integer(ALL_INT);
+ public static final Integer OFF_INTEGER = OFF_INT;
+ public static final Integer ERROR_INTEGER = ERROR_INT;
+ public static final Integer WARN_INTEGER = WARN_INT;
+ public static final Integer INFO_INTEGER = INFO_INT;
+ public static final Integer DEBUG_INTEGER = DEBUG_INT;
+ public static final Integer TRACE_INTEGER = TRACE_INT;
+ public static final Integer ALL_INTEGER = ALL_INT;
/**
* The <code>OFF</code> is used to turn off logging.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/JaninoEventEvaluator.java b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/JaninoEventEvaluator.java
index 8376fe1..ea2c904 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/JaninoEventEvaluator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/JaninoEventEvaluator.java
@@ -127,7 +127,7 @@ public class JaninoEventEvaluator extends
values[i++] = loggingEvent.getLoggerName();
values[i++] = loggingEvent.getLoggerContextVO();
values[i++] = loggingEvent.getLevel().toInteger();
- values[i++] = new Long(loggingEvent.getTimeStamp());
+ values[i++] = loggingEvent.getTimeStamp();
// In order to avoid NullPointerException, we could push a dummy marker if
// the event's marker is null. However, this would surprise user who
// expect to see a null marker instead of a dummy one.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java
index 86219f4..46e74cd 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/LRUMessageCache.java
@@ -46,7 +46,7 @@ class LRUMessageCache extends LinkedHashMap<String, Integer> {
if (i == null) {
i = 0;
} else {
- i = new Integer(i.intValue() + 1);
+ i = i + 1;
}
super.put(msg, i);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/FileNamePattern.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/FileNamePattern.java
index 1766982..67f207b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/FileNamePattern.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/FileNamePattern.java
@@ -138,8 +138,7 @@ public class FileNamePattern extends ContextAwareBase {
}
public String convertInt(int i) {
- Integer integerArg = new Integer(i);
- return convert(integerArg);
+ return convert(i);
}
public void setPattern(String pattern) {
diff --git a/logback-examples/src/main/java/chapters/mdc/NumberCruncherServer.java b/logback-examples/src/main/java/chapters/mdc/NumberCruncherServer.java
index 0dc1710..b52e18e 100644
--- a/logback-examples/src/main/java/chapters/mdc/NumberCruncherServer.java
+++ b/logback-examples/src/main/java/chapters/mdc/NumberCruncherServer.java
@@ -79,7 +79,7 @@ public class NumberCruncherServer extends UnicastRemoteObject
if ((n % i) == 0) {
logger.info("Found factor " + i);
- factors.addElement(new Integer(i));
+ factors.addElement(i);
do {
n /= i;
@@ -93,7 +93,7 @@ public class NumberCruncherServer extends UnicastRemoteObject
if (n != 1) {
logger.info("Found factor " + n);
- factors.addElement(new Integer(n));
+ factors.addElement(n);
}
int len = factors.size();
diff --git a/logback-examples/src/main/java/chapters/onJoran/calculator/AddAction.java b/logback-examples/src/main/java/chapters/onJoran/calculator/AddAction.java
index a296fa9..fbb960c 100644
--- a/logback-examples/src/main/java/chapters/onJoran/calculator/AddAction.java
+++ b/logback-examples/src/main/java/chapters/onJoran/calculator/AddAction.java
@@ -33,7 +33,7 @@ public class AddAction extends Action {
int first = fetchInteger(ic);
int second = fetchInteger(ic);
// Push the result of the addition for the following actions.
- ic.pushObject(new Integer(first + second));
+ ic.pushObject(first + second);
}
/**
diff --git a/logback-examples/src/main/java/chapters/onJoran/calculator/MultiplyAction.java b/logback-examples/src/main/java/chapters/onJoran/calculator/MultiplyAction.java
index 9eea5af..ba37115 100644
--- a/logback-examples/src/main/java/chapters/onJoran/calculator/MultiplyAction.java
+++ b/logback-examples/src/main/java/chapters/onJoran/calculator/MultiplyAction.java
@@ -32,7 +32,7 @@ public class MultiplyAction extends Action {
public void begin(InterpretationContext ic, String name, Attributes attributes) {
int first = fetchInteger(ic);
int second = fetchInteger(ic);
- ic.pushObject(new Integer(first * second));
+ ic.pushObject(first * second);
}
/**
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=5018a1359e255517e316e6b3…
http://github.com/ceki/logback/commit/5018a1359e255517e316e6b3b7f8f931ccd49…
commit 5018a1359e255517e316e6b3b7f8f931ccd49e1d
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Nov 7 12:50:33 2011 +0100
Making sure streams are always closed.
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/Compressor.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/Compressor.java
index 9819391..0132322 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/Compressor.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/Compressor.java
@@ -13,9 +13,11 @@
*/
package ch.qos.logback.core.rolling.helper;
+import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.zip.GZIPOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -88,10 +90,11 @@ public class Compressor extends ContextAwareBase {
return;
}
+ BufferedInputStream bis = null;
+ ZipOutputStream zos = null;
try {
- FileOutputStream fos = new FileOutputStream(nameOfZippedFile);
- ZipOutputStream zos = new ZipOutputStream(fos);
- FileInputStream fis = new FileInputStream(nameOfFile2zip);
+ bis = new BufferedInputStream(new FileInputStream(nameOfFile2zip));
+ zos = new ZipOutputStream(new FileOutputStream(nameOfZippedFile));
ZipEntry zipEntry = computeZipEntry(innerEntryName);
zos.putNextEntry(zipEntry);
@@ -99,12 +102,14 @@ public class Compressor extends ContextAwareBase {
byte[] inbuf = new byte[8102];
int n;
- while ((n = fis.read(inbuf)) != -1) {
+ while ((n = bis.read(inbuf)) != -1) {
zos.write(inbuf, 0, n);
}
- fis.close();
+ bis.close();
+ bis = null;
zos.close();
+ zos = null;
if (!file2zip.delete()) {
addStatus(new WarnStatus("Could not delete [" + nameOfFile2zip + "].",
@@ -113,7 +118,24 @@ public class Compressor extends ContextAwareBase {
} catch (Exception e) {
addStatus(new ErrorStatus("Error occurred while compressing ["
+ nameOfFile2zip + "] into [" + nameOfZippedFile + "].", this, e));
+ } finally {
+ if(bis != null) {
+ try {
+ bis.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ if(zos != null) {
+ try {
+ zos.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
}
+
+
}
// http://jira.qos.ch/browse/LBCORE-98
@@ -164,19 +186,22 @@ public class Compressor extends ContextAwareBase {
return;
}
+ BufferedInputStream bis = null;
+ GZIPOutputStream gzos = null;
try {
- FileOutputStream fos = new FileOutputStream(nameOfgzedFile);
- GZIPOutputStream gzos = new GZIPOutputStream(fos);
- FileInputStream fis = new FileInputStream(nameOfFile2gz);
+ bis = new BufferedInputStream(new FileInputStream(nameOfFile2gz));
+ gzos = new GZIPOutputStream(new FileOutputStream(nameOfgzedFile));
byte[] inbuf = new byte[8102];
int n;
- while ((n = fis.read(inbuf)) != -1) {
+ while ((n = bis.read(inbuf)) != -1) {
gzos.write(inbuf, 0, n);
}
- fis.close();
+ bis.close();
+ bis = null;
gzos.close();
+ gzos = null;
if (!file2gz.delete()) {
addStatus(new WarnStatus("Could not delete [" + nameOfFile2gz + "].",
@@ -185,6 +210,21 @@ public class Compressor extends ContextAwareBase {
} catch (Exception e) {
addStatus(new ErrorStatus("Error occurred while compressing ["
+ nameOfFile2gz + "] into [" + nameOfgzedFile + "].", this, e));
+ } finally {
+ if(bis != null) {
+ try {
+ bis.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ if(gzos != null) {
+ try {
+ gzos.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/RenameUtil.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/RenameUtil.java
index f5045b8..9592838 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/RenameUtil.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/RenameUtil.java
@@ -14,6 +14,8 @@
package ch.qos.logback.core.rolling.helper;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -75,18 +77,22 @@ public class RenameUtil extends ContextAwareBase {
public void renameByCopying(String from, String to)
throws RolloverFailure {
+ BufferedInputStream bis = null;
+ BufferedOutputStream bos = null;
try {
- FileInputStream fis = new FileInputStream(from);
- FileOutputStream fos = new FileOutputStream(to);
+ bis = new BufferedInputStream(new FileInputStream(from));
+ bos = new BufferedOutputStream(new FileOutputStream(to));
byte[] inbuf = new byte[BUF_SIZE];
int n;
- while ((n = fis.read(inbuf)) != -1) {
- fos.write(inbuf, 0, n);
+ while ((n = bis.read(inbuf)) != -1) {
+ bos.write(inbuf, 0, n);
}
- fis.close();
- fos.close();
+ bis.close();
+ bis = null;
+ bos.close();
+ bos = null;
File fromFile = new File(from);
@@ -96,6 +102,21 @@ public class RenameUtil extends ContextAwareBase {
} catch (IOException ioe) {
addError("Failed to rename file by copying", ioe);
throw new RolloverFailure("Failed to rename file by copying");
+ } finally {
+ if(bis != null) {
+ try {
+ bis.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ if(bos != null) {
+ try {
+ bos.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
}
}
@@ -113,4 +134,4 @@ public class RenameUtil extends ContextAwareBase {
public String toString() {
return "c.q.l.co.rolling.helper.RenameUtil";
}
-}
\ No newline at end of file
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/util/FileUtil.java b/logback-core/src/main/java/ch/qos/logback/core/util/FileUtil.java
index 05bc439..008bf33 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/util/FileUtil.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/util/FileUtil.java
@@ -62,23 +62,28 @@ public class FileUtil {
return null;
}
- URLConnection urlConnection = null;
+ InputStreamReader isr = null;
try {
- urlConnection = url.openConnection();
+ URLConnection urlConnection = url.openConnection();
urlConnection.setUseCaches(false);
- InputStream is = urlConnection.getInputStream();
- InputStreamReader isr = new InputStreamReader(is);
+ isr = new InputStreamReader(urlConnection.getInputStream());
char[] buf = new char[128];
StringBuilder builder = new StringBuilder();
int count = -1;
while ((count = isr.read(buf, 0, buf.length)) != -1) {
builder.append(buf, 0, count);
}
- isr.close();
- is.close();
return builder.toString();
} catch (IOException e) {
ca.addError("Failled to open " + resourceName, e);
+ } finally {
+ if(isr != null) {
+ try {
+ isr.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
}
return null;
}
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=9e6ef7433b9d8cc8489f5d3f…
http://github.com/ceki/logback/commit/9e6ef7433b9d8cc8489f5d3fc34ec500728d3…
commit 9e6ef7433b9d8cc8489f5d3fc34ec500728d3925
Merge: c634320 0d57c38
Author: Jörn Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Nov 7 03:35:32 2011 -0800
Merge pull request #32 from motlin/master
Two fixes from static-analysis tools.
Reviewed changes.
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=0d57c38a28952dbb03f87784…
http://github.com/ceki/logback/commit/0d57c38a28952dbb03f87784390986b64e9aa…
commit 0d57c38a28952dbb03f87784390986b64e9aaf45
Author: Craig P. Motlin <cmotlin(a)gmail.com>
Date: Sun Nov 6 21:13:21 2011 -0500
Remove redundant 'final' modifier from private methods.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
index 1696123..7acb1aa 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
@@ -130,7 +130,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
return name;
}
- private final boolean isRootLogger() {
+ private boolean isRootLogger() {
// only the root logger has a null parent
return parent == null;
}
@@ -405,7 +405,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
* logging by about 20 nanoseconds.
*/
- private final void filterAndLog_0_Or3Plus(final String localFQCN,
+ private void filterAndLog_0_Or3Plus(final String localFQCN,
final Marker marker, final Level level, final String msg,
final Object[] params, final Throwable t) {
@@ -424,7 +424,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
buildLoggingEventAndAppend(localFQCN, marker, level, msg, params, t);
}
- private final void filterAndLog_1(final String localFQCN,
+ private void filterAndLog_1(final String localFQCN,
final Marker marker, final Level level, final String msg,
final Object param, final Throwable t) {
@@ -443,7 +443,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
new Object[] { param }, t);
}
- private final void filterAndLog_2(final String localFQCN,
+ private void filterAndLog_2(final String localFQCN,
final Marker marker, final Level level, final String msg,
final Object param1, final Object param2, final Throwable t) {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/HLogger.java b/logback-classic/src/test/java/ch/qos/logback/classic/HLogger.java
index 9b87830..a9ec26b 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/HLogger.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/HLogger.java
@@ -87,7 +87,7 @@ public class HLogger extends MarkerIgnoringBase {
return name;
}
- private final boolean isRootLogger() {
+ private boolean isRootLogger() {
// only the root logger has a null parent
return parent == null;
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java b/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
index b123401..38b3b9b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
@@ -105,7 +105,7 @@ public class FileAppender<E> extends OutputStreamAppender<E> {
addInfo("File property is set to [" + fileName + "]");
if (prudent) {
- if (isAppend() == false) {
+ if (!isAppend()) {
setAppend(true);
addWarn("Setting \"Append\" property to true on account of \"Prudent\" mode");
}
@@ -183,7 +183,7 @@ public class FileAppender<E> extends OutputStreamAppender<E> {
this.append = append;
}
- final private void safeWrite(E event) throws IOException {
+ private void safeWrite(E event) throws IOException {
ResilientFileOutputStream resilientFOS = (ResilientFileOutputStream) getOutputStream();
FileChannel fileChannel = resilientFOS.getChannel();
if (fileChannel == null) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientOutputStreamBase.java b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientOutputStreamBase.java
index 36a91ba..caf31f3 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientOutputStreamBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientOutputStreamBase.java
@@ -35,7 +35,7 @@ abstract public class ResilientOutputStreamBase extends OutputStream {
protected OutputStream os;
protected boolean presumedClean = true;
- final private boolean isPresumedInError() {
+ private boolean isPresumedInError() {
// existence of recoveryCoordinator indicates failed state
return (recoveryCoordinator != null && !presumedClean);
}
@@ -88,7 +88,7 @@ abstract public class ResilientOutputStreamBase extends OutputStream {
abstract OutputStream openNewOutputStream() throws IOException;
- final private void postSuccessfulWrite() {
+ private void postSuccessfulWrite() {
if (recoveryCoordinator != null) {
recoveryCoordinator = null;
statusCount = 0;
diff --git a/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTrackerImpl.java b/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTrackerImpl.java
index 6135912..59d1033 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTrackerImpl.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTrackerImpl.java
@@ -107,7 +107,7 @@ public class AppenderTrackerImpl<E> implements AppenderTracker<E> {
}
- final private boolean isEntryStale(Entry entry, long now) {
+ private boolean isEntryStale(Entry entry, long now) {
return ((entry.timestamp + THRESHOLD) < now);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTrackerImpl.java b/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTrackerImpl.java
index c7b5b1a..855eb33 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTrackerImpl.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTrackerImpl.java
@@ -145,7 +145,7 @@ public class CyclicBufferTrackerImpl<E> implements CyclicBufferTracker<E> {
return map.size();
}
- final private boolean isEntryStale(Entry entry, long now) {
+ private boolean isEntryStale(Entry entry, long now) {
return ((entry.timestamp + THRESHOLD) < now);
}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/sift/tracker/AppenderTrackerTImpl.java b/logback-core/src/test/java/ch/qos/logback/core/sift/tracker/AppenderTrackerTImpl.java
index f6edb1c..2dd5c51 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/sift/tracker/AppenderTrackerTImpl.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/sift/tracker/AppenderTrackerTImpl.java
@@ -85,7 +85,7 @@ public class AppenderTrackerTImpl implements AppenderTracker<Object> {
}
- final private boolean isEntryStale(TEntry entry, long now) {
+ private boolean isEntryStale(TEntry entry, long now) {
return ((entry.timestamp + THRESHOLD) < now);
}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/spi/CyclicBufferTracker_TImpl.java b/logback-core/src/test/java/ch/qos/logback/core/spi/CyclicBufferTracker_TImpl.java
index 4ac331a..79545ce 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/spi/CyclicBufferTracker_TImpl.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/spi/CyclicBufferTracker_TImpl.java
@@ -96,7 +96,7 @@ public class CyclicBufferTracker_TImpl<E> implements CyclicBufferTracker<E> {
}
}
- final private boolean isEntryStale(TEntry entry, long now) {
+ private boolean isEntryStale(TEntry entry, long now) {
return ((entry.timestamp + THRESHOLD) < now);
}
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=9982b65e6effe0910c81848d…
http://github.com/ceki/logback/commit/9982b65e6effe0910c81848db2dc5da70821c…
commit 9982b65e6effe0910c81848db2dc5da70821c9f7
Author: Craig P. Motlin <cmotlin(a)gmail.com>
Date: Sun Nov 6 20:58:38 2011 -0500
Fix problems in Javadoc references.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
index 5bf17e4..d455849 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/MarkerFilter.java
@@ -57,7 +57,7 @@ public class MarkerFilter extends MatchingFilter {
/**
* The marker to match in the event.
*
- * @param markerToMatch
+ * @param markerStr
*/
public void setMarker(String markerStr) {
if(markerStr != null) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/BasicStatusManager.java b/logback-core/src/main/java/ch/qos/logback/core/BasicStatusManager.java
index 5462639..77c2c86 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/BasicStatusManager.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/BasicStatusManager.java
@@ -50,7 +50,7 @@ public class BasicStatusManager implements StatusManager {
/**
* Add a new status object.
*
- * @param Status
+ * @param newStatus
* the status message to add
*/
public void add(Status newStatus) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java b/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
index 38f55ee..b123401 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
@@ -139,15 +139,8 @@ public class FileAppender<E> extends OutputStreamAppender<E> {
* <b>Do not use this method directly. To configure a FileAppender or one of
* its subclasses, set its properties one by one and then call start().</b>
*
- * @param filename
+ * @param file_name
* The path to the log file.
- * @param append
- * If true will append to fileName. Otherwise will truncate fileName.
- * @param bufferedIO
- * @param bufferSize
- *
- * @throws IOException
- *
*/
public void openFile(String file_name) throws IOException {
synchronized (lock) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DataSourceConnectionSource.java b/logback-core/src/main/java/ch/qos/logback/core/db/DataSourceConnectionSource.java
index 8b6f060..360aff9 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DataSourceConnectionSource.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DataSourceConnectionSource.java
@@ -60,7 +60,7 @@ public class DataSourceConnectionSource extends ConnectionSourceBase {
}
/**
- * @see ch.qos.logback.classic.db.ConnectionSource#getConnection()
+ * @see ch.qos.logback.core.db.ConnectionSource#getConnection()
*/
public Connection getConnection() throws SQLException {
if (dataSource == null) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/DriverManagerConnectionSource.java b/logback-core/src/main/java/ch/qos/logback/core/db/DriverManagerConnectionSource.java
index 635982a..c534e63 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/DriverManagerConnectionSource.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/DriverManagerConnectionSource.java
@@ -45,7 +45,7 @@ public class DriverManagerConnectionSource extends ConnectionSourceBase {
}
/**
- * @see ch.qos.logback.classic.db.ConnectionSource#getConnection()
+ * @see ch.qos.logback.core.db.ConnectionSource#getConnection()
*/
public Connection getConnection() throws SQLException {
if (getUser() == null) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java b/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java
index 8aeaead..827d928 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java
@@ -19,11 +19,11 @@ import ch.qos.logback.core.spi.FilterReply;
/**
* The value of the {@link #onMatch} and {@link #onMismatch} attributes is set
- * to {@link Filter.NEUTRAL}, so that a badly configured evaluator filter does
+ * to {@link FilterReply#NEUTRAL}, so that a badly configured evaluator filter does
* not disturb the functioning of the filter chain.
*
* <p>It is expected that one of the two attributes will have its value changed
- * to {@link Filter.ACCEPT} or {@link Filter.DENY}. That way, it is possible to
+ * to {@link FilterReply#ACCEPT} or {@link FilterReply#DENY}. That way, it is possible to
* decide if a given result must be returned after the evaluation either failed
* or succeeded.
*
diff --git a/logback-core/src/main/java/ch/qos/logback/core/filter/Filter.java b/logback-core/src/main/java/ch/qos/logback/core/filter/Filter.java
index dfef0be..063106b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/filter/Filter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/filter/Filter.java
@@ -47,10 +47,10 @@ public abstract class Filter<E> extends ContextAwareBase implements LifeCycle {
}
/**
- * If the decision is <code>{@link #DENY}</code>, then the event will be
- * dropped. If the decision is <code>{@link #NEUTRAL}</code>, then the next
+ * If the decision is <code>{@link FilterReply#DENY}</code>, then the event will be
+ * dropped. If the decision is <code>{@link FilterReply#NEUTRAL}</code>, then the next
* filter, if any, will be invoked. If the decision is
- * <code>{@link #ACCEPT}</code> then the event will be logged without
+ * <code>{@link FilterReply#ACCEPT}</code> then the event will be logged without
* consulting with other filters in the chain.
*
* @param event
diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
index 51c2115..3319419 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
@@ -236,7 +236,7 @@ public abstract class SyslogAppenderBase<E> extends AppenderBase<E> {
* The <b>suffixPattern</b> option specifies the format of the
* non-standardized part of the message sent to the syslog server.
*
- * @param pattern
+ * @param suffixPattern
*/
public void setSuffixPattern(String suffixPattern) {
this.suffixPattern = suffixPattern;
diff --git a/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetterException.java b/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetterException.java
index 6f70ce8..7d054ac 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetterException.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetterException.java
@@ -15,7 +15,7 @@ package ch.qos.logback.core.util;
/**
* Thrown when an error is encountered whilst attempting to set a property
- * using the {@link PropertySetter} utility class.
+ * using the {@link ch.qos.logback.core.joran.util.PropertySetter} utility class.
*
* @author Anders Kristensen
*/
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=c634320ef70225e0a4672834…
http://github.com/ceki/logback/commit/c634320ef70225e0a467283461a15040afc6a…
commit c634320ef70225e0a467283461a15040afc6a6c2
Merge: c8ba2fe 6f64b16
Author: Jörn Huxhorn <jhuxhorn(a)googlemail.com>
Date: Sun Nov 6 14:12:38 2011 -0800
Merge pull request #31 from motlin/interface-modifier
Remove unnecessary interface modifiers.
Checked the changes.
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=6f64b161569ae15a7acfe744…
http://github.com/ceki/logback/commit/6f64b161569ae15a7acfe744a10d3157743a2…
commit 6f64b161569ae15a7acfe744a10d3157743a2d40
Author: Craig P. Motlin <cmotlin(a)gmail.com>
Date: Sun Nov 6 10:06:59 2011 -0500
Remove unnecessary interface modifiers.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/IEvaluator.java b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/IEvaluator.java
index f2dd216..e20659e 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/boolex/IEvaluator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/boolex/IEvaluator.java
@@ -21,6 +21,6 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
* @author Ceki Gücü
*/
public interface IEvaluator {
- public boolean doEvaluate(ILoggingEvent event);
+ boolean doEvaluate(ILoggingEvent event);
}
\ No newline at end of file
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfiguratorMBean.java b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfiguratorMBean.java
index 84a4586..4cdde15 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfiguratorMBean.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/JMXConfiguratorMBean.java
@@ -21,19 +21,19 @@ import ch.qos.logback.core.joran.spi.JoranException;
public interface JMXConfiguratorMBean {
- public void reloadDefaultConfiguration() throws JoranException;
+ void reloadDefaultConfiguration() throws JoranException;
- public void reloadByFileName(String fileName) throws JoranException, FileNotFoundException;
+ void reloadByFileName(String fileName) throws JoranException, FileNotFoundException;
- public void reloadByURL(URL url) throws JoranException;
+ void reloadByURL(URL url) throws JoranException;
- public void setLoggerLevel(String loggerName, String levelStr);
+ void setLoggerLevel(String loggerName, String levelStr);
- public String getLoggerLevel(String loggerName);
+ String getLoggerLevel(String loggerName);
- public String getLoggerEffectiveLevel(String loggerName);
+ String getLoggerEffectiveLevel(String loggerName);
- public List<String> getLoggerList();
+ List<String> getLoggerList();
- public List<String> getStatuses();
+ List<String> getStatuses();
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Abbreviator.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Abbreviator.java
index 2ae80bc..b2a9892 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Abbreviator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/Abbreviator.java
@@ -20,5 +20,5 @@ package ch.qos.logback.classic.pattern;
*/
public interface Abbreviator {
- public String abbreviate(String in);
+ String abbreviate(String in);
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextSelector.java b/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextSelector.java
index f3f69df..41c419c 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextSelector.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/selector/ContextSelector.java
@@ -28,13 +28,13 @@ import ch.qos.logback.classic.LoggerContext;
*/
public interface ContextSelector {
- public LoggerContext getLoggerContext();
+ LoggerContext getLoggerContext();
- public LoggerContext getLoggerContext(String name);
+ LoggerContext getLoggerContext(String name);
- public LoggerContext getDefaultLoggerContext();
+ LoggerContext getDefaultLoggerContext();
- public LoggerContext detachLoggerContext(String loggerContextName);
+ LoggerContext detachLoggerContext(String loggerContextName);
- public List<String> getContextNames();
+ List<String> getContextNames();
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java
index ce64e2f..1abeff7 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java
@@ -29,21 +29,21 @@ import ch.qos.logback.core.spi.DeferredProcessingAware;
*/
public interface ILoggingEvent extends DeferredProcessingAware {
- public String getThreadName();
+ String getThreadName();
- public Level getLevel();
+ Level getLevel();
- public String getMessage();
+ String getMessage();
- public Object[] getArgumentArray();
+ Object[] getArgumentArray();
- public String getFormattedMessage();
+ String getFormattedMessage();
- public String getLoggerName();
+ String getLoggerName();
- public LoggerContextVO getLoggerContextVO();
+ LoggerContextVO getLoggerContextVO();
- public IThrowableProxy getThrowableProxy();
+ IThrowableProxy getThrowableProxy();
/**
* Return caller data associated with this event. Note that calling this event
@@ -53,7 +53,7 @@ public interface ILoggingEvent extends DeferredProcessingAware {
*
* @see #hasCallerData()
*/
- public StackTraceElement[] getCallerData();
+ StackTraceElement[] getCallerData();
/**
* If this event has caller data, then true is returned. Otherwise the
@@ -65,22 +65,22 @@ public interface ILoggingEvent extends DeferredProcessingAware {
*
* @return whether this event has caller data
*/
- public boolean hasCallerData();
+ boolean hasCallerData();
- public Marker getMarker();
+ Marker getMarker();
/**
* Returns the MDC map. The returned value can be an empty map but not null.
*/
- public Map<String, String> getMDCPropertyMap();
+ Map<String, String> getMDCPropertyMap();
/**
* Synonym for [@link #getMDCPropertyMap}.
* @deprecated Replaced by [@link #getMDCPropertyMap}
*/
- public Map<String, String> getMdc();
- public long getTimeStamp();
+ Map<String, String> getMdc();
+ long getTimeStamp();
- public void prepareForDeferredProcessing();
+ void prepareForDeferredProcessing();
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAware.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAware.java
index bbd3b4b..ae9ad6f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAware.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextAware.java
@@ -28,6 +28,6 @@ public interface LoggerContextAware extends ContextAware {
* @throws IllegalStateException If you try to change the context after it
* has been set.
**/
- public void setLoggerContext(LoggerContext context);
+ void setLoggerContext(LoggerContext context);
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextListener.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextListener.java
index 87a4b6b..c210ad0 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextListener.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggerContextListener.java
@@ -25,9 +25,9 @@ public interface LoggerContextListener {
* reset. Such listeners are said to be reset resistant.
* @return whether this listener is reset resistant or not.
*/
- public boolean isResetResistant();
- public void onStart(LoggerContext context);
- public void onReset(LoggerContext context);
- public void onStop(LoggerContext context);
- public void onLevelChange(Logger logger, Level level);
+ boolean isResetResistant();
+ void onStart(LoggerContext context);
+ void onReset(LoggerContext context);
+ void onStop(LoggerContext context);
+ void onLevelChange(Logger logger, Level level);
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic36/DateFormatOriginal_tzest.java b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic36/DateFormatOriginal_tzest.java
index 77fedd2..597cfd8 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic36/DateFormatOriginal_tzest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic36/DateFormatOriginal_tzest.java
@@ -176,7 +176,7 @@ public class DateFormatOriginal_tzest extends TestCase {
}
- public static interface Formatter {
+ public interface Formatter {
String format(Date date);
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/Builder.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/Builder.java
index 51d71e8..ec9b149 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/Builder.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/testObjectBuilders/Builder.java
@@ -16,7 +16,7 @@ package ch.qos.logback.classic.net.testObjectBuilders;
public interface Builder {
// 45 characters message
- final String MSG_PREFIX = "aaaaabbbbbcccccdddddaaaaabbbbbcccccdddddaaaa";
+ String MSG_PREFIX = "aaaaabbbbbcccccdddddaaaaabbbbbcccccdddddaaaa";
// final String MSG_PREFIX = "a";
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/CPDCSpecial.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/CPDCSpecial.java
index 36452fe..66e7edc 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/CPDCSpecial.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/CPDCSpecial.java
@@ -15,10 +15,10 @@ package ch.qos.logback.classic.spi;
public interface CPDCSpecial {
- public abstract void doTest();
+ void doTest();
- public abstract Throwable getThrowable();
+ Throwable getThrowable();
- public abstract IThrowableProxy getThrowableProxy();
+ IThrowableProxy getThrowableProxy();
}
\ No newline at end of file
diff --git a/logback-core/src/main/java/ch/qos/logback/core/Appender.java b/logback-core/src/main/java/ch/qos/logback/core/Appender.java
index a0d0026..ff76f42 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/Appender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/Appender.java
@@ -23,7 +23,7 @@ public interface Appender<E> extends LifeCycle, ContextAware, FilterAttachable<E
/**
* Get the name of this appender. The name uniquely identifies the appender.
*/
- public String getName();
+ String getName();
/**
* This is where an appender accomplishes its work. Note that the argument
@@ -37,6 +37,6 @@ public interface Appender<E> extends LifeCycle, ContextAware, FilterAttachable<E
* identify this appender.
*
*/
- public void setName(String name);
+ void setName(String name);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/Context.java b/logback-core/src/main/java/ch/qos/logback/core/Context.java
index 07d9612..aaceaa0 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/Context.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/Context.java
@@ -32,7 +32,7 @@ public interface Context extends PropertyContainer {
*
* @return the {@link StatusManager} instance in use.
*/
- public StatusManager getStatusManager();
+ StatusManager getStatusManager();
/**
* A Context can act as a store for various objects used by LOGBack
@@ -40,7 +40,7 @@ public interface Context extends PropertyContainer {
*
* @return The object stored under 'key'.
*/
- public Object getObject(String key);
+ Object getObject(String key);
/**
* Store an object under 'key'. If no object can be found, null is returned.
@@ -48,7 +48,7 @@ public interface Context extends PropertyContainer {
* @param key
* @param value
*/
- public void putObject(String key, Object value);
+ void putObject(String key, Object value);
/**
* Get all the properties for this context as a Map. Note that the returned
@@ -61,12 +61,12 @@ public interface Context extends PropertyContainer {
/**
* Get the property of this context.
*/
- public String getProperty(String key);
+ String getProperty(String key);
/**
* Set a property of this context.
*/
- public void putProperty(String key, String value);
+ void putProperty(String key, String value);
/**
@@ -74,21 +74,21 @@ public interface Context extends PropertyContainer {
* @return
* @since 0.9.20
*/
- public Map<String, String> getCopyOfPropertyMap();
+ Map<String, String> getCopyOfPropertyMap();
/**
* Contexts are named objects.
*
* @return the name for this context
*/
- public String getName();
+ String getName();
/**
* The name of the context can be set only once.
*
* @param name
*/
- public void setName(String name);
+ void setName(String name);
/**
* The time at which this context was created, expressed in
@@ -96,13 +96,13 @@ public interface Context extends PropertyContainer {
*
* @return The time as measured when this class was created.
*/
- public long getBirthTime();
+ long getBirthTime();
/**
* Object used for synchronization purposes.
* INTENDED FOR INTERNAL USAGE.
*/
- public Object getConfigurationLock();
+ Object getConfigurationLock();
/**
@@ -112,5 +112,5 @@ public interface Context extends PropertyContainer {
* @return the executor for this context.
* @since 1.0.0
*/
- public ExecutorService getExecutorService();
+ ExecutorService getExecutorService();
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluator.java b/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluator.java
index dfd8914..143be52 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluator.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/boolex/EventEvaluator.java
@@ -51,10 +51,10 @@ public interface EventEvaluator<E> extends ContextAware, LifeCycle {
*
* @return The name of this evaluator.
*/
- public String getName();
+ String getName();
/**
* Evaluators are named entities.
*/
- public void setName(String name);
+ void setName(String name);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSource.java b/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSource.java
index 96ab124..5c03e5f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSource.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/ConnectionSource.java
@@ -56,6 +56,6 @@ public interface ConnectionSource extends LifeCycle {
/**
* If the connection does not support batch updates, we will avoid using them.
- */
- public boolean supportsBatchUpdates();
+ */
+ boolean supportsBatchUpdates();
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialect.java b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialect.java
index d65601d..3244a34 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialect.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/db/dialect/SQLDialect.java
@@ -18,5 +18,5 @@ package ch.qos.logback.core.db.dialect;
*
*/
public interface SQLDialect {
- public String getSelectInsertId();
+ String getSelectInsertId();
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/html/CssBuilder.java b/logback-core/src/main/java/ch/qos/logback/core/html/CssBuilder.java
index a1685e0..6dd7a1d 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/html/CssBuilder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/html/CssBuilder.java
@@ -15,6 +15,6 @@ package ch.qos.logback.core.html;
public interface CssBuilder {
- public void addCss(StringBuilder sbuf);
+ void addCss(StringBuilder sbuf);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/html/IThrowableRenderer.java b/logback-core/src/main/java/ch/qos/logback/core/html/IThrowableRenderer.java
index 8ba987f..874041e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/html/IThrowableRenderer.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/html/IThrowableRenderer.java
@@ -16,6 +16,6 @@ package ch.qos.logback.core.html;
public interface IThrowableRenderer<E> {
- public void render(StringBuilder sbuf, E event);
+ void render(StringBuilder sbuf, E event);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/Condition.java b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/Condition.java
index 4b29279..5f6a113 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/Condition.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/Condition.java
@@ -14,5 +14,5 @@
package ch.qos.logback.core.joran.conditional;
public interface Condition {
- public boolean evaluate();
+ boolean evaluate();
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/event/InPlayListener.java b/logback-core/src/main/java/ch/qos/logback/core/joran/event/InPlayListener.java
index b64f0ad..47b0fed 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/event/InPlayListener.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/event/InPlayListener.java
@@ -15,5 +15,5 @@ package ch.qos.logback.core.joran.event;
public interface InPlayListener {
- public void inPlay(SaxEvent event);
+ void inPlay(SaxEvent event);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/RuleStore.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/RuleStore.java
index 70e0d9a..6618ddc 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/RuleStore.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/RuleStore.java
@@ -30,10 +30,10 @@ import ch.qos.logback.core.joran.action.Action;
*
*/
public interface RuleStore {
- public void addRule(Pattern pattern, String actionClassStr)
+ void addRule(Pattern pattern, String actionClassStr)
throws ClassNotFoundException;
- public void addRule(Pattern pattern, Action action);
+ void addRule(Pattern pattern, Action action);
- public List matchActions(Pattern currentPatern);
+ List matchActions(Pattern currentPatern);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingPolicy.java
index 1714b64..424affe 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingPolicy.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingPolicy.java
@@ -36,7 +36,7 @@ public interface RollingPolicy extends LifeCycle {
* @throws RolloverFailure
* Thrown if the rollover operation fails for any reason.
*/
- public void rollover() throws RolloverFailure;
+ void rollover() throws RolloverFailure;
/**
* Get the name of the active log file.
@@ -47,14 +47,14 @@ public interface RollingPolicy extends LifeCycle {
* <p>On other implementations, this method might return the FileAppender's
* file property.
*/
- public String getActiveFileName();
+ String getActiveFileName();
/**
* The compression mode for this policy.
*
* @return
*/
- public CompressionMode getCompressionMode();
+ CompressionMode getCompressionMode();
/**
* This method allows RollingPolicy implementations to be aware of their
@@ -63,5 +63,5 @@ public interface RollingPolicy extends LifeCycle {
* @param appender
*/
- public void setParent(FileAppender appender);
+ void setParent(FileAppender appender);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicy.java
index 32e5ad1..79fa284 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicy.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicy.java
@@ -53,7 +53,7 @@ public interface TimeBasedFileNamingAndTriggeringPolicy<E> extends
/**
* Return the archive remover appropriate for this instance.
*/
- public ArchiveRemover getArchiveRemover();
+ ArchiveRemover getArchiveRemover();
/**
* Return the current time which is usually the value returned by
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/TriggeringPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/TriggeringPolicy.java
index 60d382f..37412a8 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/TriggeringPolicy.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/TriggeringPolicy.java
@@ -35,5 +35,5 @@ public interface TriggeringPolicy<E> extends LifeCycle {
* @param event A reference to the currently event.
* @return true if a roll-over should occur.
*/
- public boolean isTriggeringEvent(final File activeFile, final E event);
+ boolean isTriggeringEvent(final File activeFile, final E event);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/ArchiveRemover.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/ArchiveRemover.java
index 865626d..f59d0dc 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/ArchiveRemover.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/ArchiveRemover.java
@@ -23,6 +23,6 @@ import ch.qos.logback.core.spi.ContextAware;
* @author Ceki Gülcü
*/
public interface ArchiveRemover extends ContextAware {
- public void clean(Date now);
- public void setMaxHistory(int maxHistory);
+ void clean(Date now);
+ void setMaxHistory(int maxHistory);
}
\ No newline at end of file
diff --git a/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTracker.java b/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTracker.java
index 684e08f..112cbbb 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTracker.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTracker.java
@@ -20,7 +20,7 @@ import ch.qos.logback.core.CoreConstants;
public interface AppenderTracker<E> {
- static int THRESHOLD = 30 * 60 * CoreConstants.MILLIS_IN_ONE_SECOND; // 30 minutes
+ int THRESHOLD = 30 * 60 * CoreConstants.MILLIS_IN_ONE_SECOND; // 30 minutes
void put(String key, Appender<E> value, long timestamp);
Appender<E> get(String key, long timestamp);
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachable.java b/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachable.java
index 7b748a7..ad52a56 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachable.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachable.java
@@ -26,23 +26,23 @@ public interface AppenderAttachable<E> {
/**
* Add an appender.
*/
- public void addAppender(Appender<E> newAppender);
+ void addAppender(Appender<E> newAppender);
/**
* Get an iterator for appenders contained in the parent object.
*/
- public Iterator<Appender<E>> iteratorForAppenders();
+ Iterator<Appender<E>> iteratorForAppenders();
/**
* Get an appender by name.
*/
- public Appender<E> getAppender(String name);
+ Appender<E> getAppender(String name);
/**
* Returns <code>true</code> if the specified appender is in list of
* attached attached, <code>false</code> otherwise.
*/
- public boolean isAttached(Appender<E> appender);
+ boolean isAttached(Appender<E> appender);
/**
* Detach and stop all previously added appenders.
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/ContextAware.java b/logback-core/src/main/java/ch/qos/logback/core/spi/ContextAware.java
index 1095533..bf6c4d7 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/spi/ContextAware.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/ContextAware.java
@@ -22,22 +22,22 @@ import ch.qos.logback.core.status.Status;
*/
public interface ContextAware {
- public void setContext(Context context);
+ void setContext(Context context);
- public Context getContext();
+ Context getContext();
- public void addStatus(Status status);
+ void addStatus(Status status);
- public void addInfo(String msg);
+ void addInfo(String msg);
- public void addInfo(String msg, Throwable ex);
+ void addInfo(String msg, Throwable ex);
- public void addWarn(String msg);
+ void addWarn(String msg);
- public void addWarn(String msg, Throwable ex);
+ void addWarn(String msg, Throwable ex);
- public void addError(String msg);
+ void addError(String msg);
- public void addError(String msg, Throwable ex);
+ void addError(String msg, Throwable ex);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTracker.java b/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTracker.java
index 1c8b587..30ffa5c 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTracker.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/CyclicBufferTracker.java
@@ -23,15 +23,15 @@ import ch.qos.logback.core.helpers.CyclicBuffer;
*/
public interface CyclicBufferTracker<E> {
- public static int DEFAULT_BUFFER_SIZE = 256;
- public static int DEFAULT_NUMBER_OF_BUFFERS = 64;
+ int DEFAULT_BUFFER_SIZE = 256;
+ int DEFAULT_NUMBER_OF_BUFFERS = 64;
- static int THRESHOLD = 30 * 60 * CoreConstants.MILLIS_IN_ONE_SECOND; // 30 minutes
+ int THRESHOLD = 30 * 60 * CoreConstants.MILLIS_IN_ONE_SECOND; // 30 minutes
- public int getBufferSize();
+ int getBufferSize();
- public void setBufferSize(int size);
- public int getMaxNumberOfBuffers();
+ void setBufferSize(int size);
+ int getMaxNumberOfBuffers();
/**
* Set the maximum number of tracked buffers. After reaching the maximum number of
@@ -40,7 +40,7 @@ public interface CyclicBufferTracker<E> {
*
* @param maxNumBuffers
*/
- public void setMaxNumberOfBuffers(int maxNumBuffers);
+ void setMaxNumberOfBuffers(int maxNumBuffers);
/**
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/DeferredProcessingAware.java b/logback-core/src/main/java/ch/qos/logback/core/spi/DeferredProcessingAware.java
index f9c2f65..6d6e7de 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/spi/DeferredProcessingAware.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/DeferredProcessingAware.java
@@ -15,5 +15,5 @@ package ch.qos.logback.core.spi;
public interface DeferredProcessingAware {
- public void prepareForDeferredProcessing();
+ void prepareForDeferredProcessing();
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/FilterAttachable.java b/logback-core/src/main/java/ch/qos/logback/core/spi/FilterAttachable.java
index d60ebb2..09d1aad 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/spi/FilterAttachable.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/FilterAttachable.java
@@ -26,9 +26,9 @@ public interface FilterAttachable<E> {
/**
* Add a filter.
*/
- public void addFilter(Filter<E> newFilter);
+ void addFilter(Filter<E> newFilter);
- public void clearAllFilters();
+ void clearAllFilters();
/**
* Get a copy of all the filters contained within this FilterAttachable
@@ -36,12 +36,12 @@ public interface FilterAttachable<E> {
*
* @return all attached filters as a list
*/
- public List<Filter<E>> getCopyOfAttachedFiltersList();
+ List<Filter<E>> getCopyOfAttachedFiltersList();
/**
* Loop through the filters in the chain. As soon as a filter decides on
* ACCEPT or DENY, then that value is returned. If all of the filters return
* NEUTRAL, then NEUTRAL is returned.
*/
- public FilterReply getFilterChainDecision(E event);
+ FilterReply getFilterChainDecision(E event);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/LifeCycle.java b/logback-core/src/main/java/ch/qos/logback/core/spi/LifeCycle.java
index b08ab68..9a33377 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/spi/LifeCycle.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/LifeCycle.java
@@ -15,8 +15,8 @@ package ch.qos.logback.core.spi;
public interface LifeCycle {
- public void start();
- public void stop();
- public boolean isStarted();
+ void start();
+ void stop();
+ boolean isStarted();
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/PropertyContainer.java b/logback-core/src/main/java/ch/qos/logback/core/spi/PropertyContainer.java
index 45bb9f4..f6829eb 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/spi/PropertyContainer.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/PropertyContainer.java
@@ -15,5 +15,5 @@ package ch.qos.logback.core.spi;
public interface PropertyContainer {
- public String getProperty(String key);
+ String getProperty(String key);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/status/Status.java b/logback-core/src/main/java/ch/qos/logback/core/status/Status.java
index ace891d..fc1a98b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/status/Status.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/status/Status.java
@@ -18,9 +18,9 @@ import java.util.Iterator;
public interface Status {
- public final int INFO = 0;
- public final int WARN = 1;
- public final int ERROR = 2;
+ int INFO = 0;
+ int WARN = 1;
+ int ERROR = 2;
int getLevel();
int getEffectiveLevel();
@@ -29,9 +29,9 @@ public interface Status {
Throwable getThrowable();
Long getDate();
- public boolean hasChildren();
- public void add(Status child);
- public boolean remove(Status child);
- public Iterator<Status> iterator();
+ boolean hasChildren();
+ void add(Status child);
+ boolean remove(Status child);
+ Iterator<Status> iterator();
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/status/StatusManager.java b/logback-core/src/main/java/ch/qos/logback/core/status/StatusManager.java
index f64fa7c..83fb28b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/status/StatusManager.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/status/StatusManager.java
@@ -27,47 +27,47 @@ public interface StatusManager {
*
* @param status
*/
- public void add(Status status);
+ void add(Status status);
/**
* Obtain a copy of the status list maintained by this StatusManager.
*
* @return
*/
- public List<Status> getCopyOfStatusList();
+ List<Status> getCopyOfStatusList();
/**
* Return the highest level of all the statii.
*
* @return
*/
- //public int getLevel();
+ //int getLevel();
/**
* Return the number of status entries.
*
* @return
*/
- public int getCount();
+ int getCount();
/**
* Add a status listener.
* @param listener
*/
- public void add(StatusListener listener);
+ void add(StatusListener listener);
/**
* Remove a status listener.
*
* @param listener
*/
- public void remove(StatusListener listener);
+ void remove(StatusListener listener);
/**
* Clear the list of status messages.
*/
- public void clear();
+ void clear();
/**
@@ -75,6 +75,6 @@ public interface StatusManager {
*
* @return
*/
- public List<StatusListener> getCopyOfStatusListenerList();
+ List<StatusListener> getCopyOfStatusListenerList();
}
-----------------------------------------------------------------------
Summary of changes:
.../ch/qos/logback/access/AccessConstants.java | 19 +++----
.../java/ch/qos/logback/access/db/DBAppender.java | 1 -
.../ch/qos/logback/classic/ClassicConstants.java | 18 +++---
.../main/java/ch/qos/logback/classic/Level.java | 14 ++--
.../main/java/ch/qos/logback/classic/Logger.java | 22 ++++----
.../ch/qos/logback/classic/boolex/IEvaluator.java | 2 +-
.../classic/boolex/JaninoEventEvaluator.java | 2 +-
.../java/ch/qos/logback/classic/db/DBAppender.java | 3 -
.../logback/classic/jmx/JMXConfiguratorMBean.java | 16 +++---
.../qos/logback/classic/pattern/Abbreviator.java | 2 +-
.../logback/classic/selector/ContextSelector.java | 10 ++--
.../ch/qos/logback/classic/spi/ILoggingEvent.java | 30 +++++-----
.../logback/classic/spi/LoggerContextAware.java | 2 +-
.../logback/classic/spi/LoggerContextListener.java | 10 ++--
.../qos/logback/classic/turbo/LRUMessageCache.java | 2 +-
.../ch/qos/logback/classic/turbo/MarkerFilter.java | 2 +-
.../test/java/ch/qos/logback/classic/HLogger.java | 2 +-
.../lbclassic36/DateFormatOriginal_tzest.java | 2 +-
.../classic/net/testObjectBuilders/Builder.java | 2 +-
.../ch/qos/logback/classic/spi/CPDCSpecial.java | 6 +-
.../main/java/ch/qos/logback/core/Appender.java | 4 +-
.../ch/qos/logback/core/BasicStatusManager.java | 2 +-
.../src/main/java/ch/qos/logback/core/Context.java | 22 ++++----
.../java/ch/qos/logback/core/CoreConstants.java | 38 ++++++------
.../java/ch/qos/logback/core/FileAppender.java | 13 +---
.../ch/qos/logback/core/boolex/EventEvaluator.java | 4 +-
.../ch/qos/logback/core/db/ConnectionSource.java | 4 +-
.../ch/qos/logback/core/db/DBAppenderBase.java | 2 -
.../core/db/DataSourceConnectionSource.java | 2 +-
.../core/db/DriverManagerConnectionSource.java | 2 +-
.../ch/qos/logback/core/db/dialect/SQLDialect.java | 2 +-
.../qos/logback/core/filter/EvaluatorFilter.java | 4 +-
.../java/ch/qos/logback/core/filter/Filter.java | 6 +-
.../java/ch/qos/logback/core/html/CssBuilder.java | 2 +-
.../qos/logback/core/html/IThrowableRenderer.java | 2 +-
.../logback/core/joran/GenericConfigurator.java | 16 +++---
.../logback/core/joran/action/TimestampAction.java | 2 +-
.../logback/core/joran/conditional/Condition.java | 2 +-
.../logback/core/joran/event/InPlayListener.java | 2 +-
.../ch/qos/logback/core/joran/spi/Interpreter.java | 10 ++--
.../ch/qos/logback/core/joran/spi/Pattern.java | 9 +--
.../ch/qos/logback/core/joran/spi/RuleStore.java | 6 +-
.../qos/logback/core/net/SyslogAppenderBase.java | 7 ++-
.../core/pattern/util/RegularEscapeUtil.java | 6 +-
.../core/recovery/ResilientOutputStreamBase.java | 4 +-
.../ch/qos/logback/core/rolling/RollingPolicy.java | 8 +-
.../TimeBasedFileNamingAndTriggeringPolicy.java | 2 +-
.../qos/logback/core/rolling/TriggeringPolicy.java | 2 +-
.../core/rolling/helper/ArchiveRemover.java | 4 +-
.../logback/core/rolling/helper/Compressor.java | 60 ++++++++++++++++---
.../core/rolling/helper/FileNamePattern.java | 3 +-
.../logback/core/rolling/helper/RenameUtil.java | 35 +++++++++--
.../ch/qos/logback/core/sift/AppenderTracker.java | 2 +-
.../qos/logback/core/sift/AppenderTrackerImpl.java | 2 +-
.../qos/logback/core/spi/AppenderAttachable.java | 8 +-
.../java/ch/qos/logback/core/spi/ContextAware.java | 18 +++---
.../qos/logback/core/spi/CyclicBufferTracker.java | 14 ++--
.../logback/core/spi/CyclicBufferTrackerImpl.java | 2 +-
.../logback/core/spi/DeferredProcessingAware.java | 2 +-
.../ch/qos/logback/core/spi/FilterAttachable.java | 8 +-
.../java/ch/qos/logback/core/spi/LifeCycle.java | 6 +-
.../ch/qos/logback/core/spi/PropertyContainer.java | 2 +-
.../java/ch/qos/logback/core/status/Status.java | 14 ++--
.../ch/qos/logback/core/status/StatusManager.java | 16 +++---
.../java/ch/qos/logback/core/util/FileUtil.java | 17 ++++--
.../logback/core/util/PropertySetterException.java | 2 +-
.../core/sift/tracker/AppenderTrackerTImpl.java | 2 +-
.../core/spi/CyclicBufferTracker_TImpl.java | 2 +-
.../java/chapters/mdc/NumberCruncherServer.java | 4 +-
.../chapters/onJoran/calculator/AddAction.java | 2 +-
.../onJoran/calculator/MultiplyAction.java | 2 +-
71 files changed, 315 insertions(+), 264 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0
I just did a git pull from github and on my MacBook I got
target/test-output/1352452803/failed_rename.log src/test/witness/rolling/tbr-failed_renameFiles [target/test-output/1352452803/failed_rename.log] and [src/test/witness/rolling/tbr-failed_rename] differ on line 1
One reads: [Hello---2].
Other reads:[Hello---0].
--------------------------------
Contents of target/test-output/1352452803/failed_rename.log:
1 : Hello---2
--------------------------------
Contents of src/test/witness/rolling/tbr-failed_rename:
1 : Hello---0
2 : Hello---1
3 : Hello---2
20:05:02,312 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No compression will be used
20:05:02,312 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern target/test-output/1352452803/failed_rename-%d{yyyy-MM-dd_HH_mm_ss} for the active file
20:05:02,312 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd_HH_mm_ss' from file name pattern 'target/test-output/1352452803/failed_rename-%d{yyyy-MM-dd_HH_mm_ss}'.
20:05:02,312 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over every second.
20:05:02,312 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Sat Nov 05 20:05:02 PDT 2011
20:05:02,312 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[null] - Active log file name: target/test-output/1352452803/failed_rename.log
20:05:02,312 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[null] - File property is set to [target/test-output/1352452803/failed_rename.log]
20:05:02,312 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Elapsed period: Sat Nov 05 20:05:02 PDT 2011
20:05:02,312 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [target/test-output/1352452803/failed_rename.log] to [target/test-output/1352452803/failed_rename-2011-11-05_20_05_02]
20:05:02,313 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Elapsed period: Sat Nov 05 20:05:03 PDT 2011
20:05:02,313 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [target/test-output/1352452803/failed_rename.log] to [target/test-output/1352452803/failed_rename-2011-11-05_20_05_03]
Tests run: 9, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: -1,993,739.736 sec <<< FAILURE!
Results :
Failed tests: montlyRollover(ch.qos.logback.core.rolling.TimeBasedRollingWithArchiveRemoval_STest): expected:<3> but was:<4>
failed_rename(ch.qos.logback.core.rolling.TimeBasedRolling_STest)
Tests run: 317, Failures: 2, Errors: 0, Skipped: 3
2
1

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-14-gc8ba2fe
by git-noreply@pixie.qos.ch 05 Nov '11
by git-noreply@pixie.qos.ch 05 Nov '11
05 Nov '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via c8ba2fe56d8365b5062e080de71363679c3bd3d0 (commit)
from c4012ae2d75b370754f327d5ad896baccf636bb7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=c8ba2fe56d8365b5062e080d…
http://github.com/ceki/logback/commit/c8ba2fe56d8365b5062e080de71363679c3bd…
commit c8ba2fe56d8365b5062e080de71363679c3bd3d0
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Sat Nov 5 00:28:01 2011 +0100
set context property after reset
diff --git a/logback-site/src/site/pages/faq.html b/logback-site/src/site/pages/faq.html
index d684998..014a460 100644
--- a/logback-site/src/site/pages/faq.html
+++ b/logback-site/src/site/pages/faq.html
@@ -242,12 +242,12 @@
</p>
<p class="source"> LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- // inject the name of the current application as "application-name"
- // property of the LoggerContext
- <b>context.putProperty("application-name", NAME_OF_CURRENT_APPLICATION);</b>
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(context);
context.reset(); // override default configuration
+ // inject the name of the current application as "application-name"
+ // property of the LoggerContext
+ <b>context.putProperty("application-name", NAME_OF_CURRENT_APPLICATION);</b>
jc.doConfigure("/path/to/the/above/configuration/file.xml"); </p>
<hr/>
-----------------------------------------------------------------------
Summary of changes:
logback-site/src/site/pages/faq.html | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-13-gc4012ae
by git-noreply@pixie.qos.ch 05 Nov '11
by git-noreply@pixie.qos.ch 05 Nov '11
05 Nov '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via c4012ae2d75b370754f327d5ad896baccf636bb7 (commit)
from 01ae278bdf133e73f7676eebf957d07eca173a03 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=c4012ae2d75b370754f327d5…
http://github.com/ceki/logback/commit/c4012ae2d75b370754f327d5ad896baccf636…
commit c4012ae2d75b370754f327d5ad896baccf636bb7
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Fri Nov 4 23:57:30 2011 +0100
small impovents
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/DefaultTimeBasedFileNamingAndTriggeringPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/DefaultTimeBasedFileNamingAndTriggeringPolicy.java
index 6010c43..45ffa3b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/DefaultTimeBasedFileNamingAndTriggeringPolicy.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/DefaultTimeBasedFileNamingAndTriggeringPolicy.java
@@ -39,6 +39,7 @@ public class DefaultTimeBasedFileNamingAndTriggeringPolicy<E> extends
long time = getCurrentTime();
if (time >= nextCheck) {
Date dateOfElapsedPeriod = dateInCurrentPeriod;
+ addInfo("Elapsed period: "+dateOfElapsedPeriod);
elapsedPeriodsFileName = tbrp.fileNamePatternWCS
.convert(dateOfElapsedPeriod);
setDateInCurrentPeriod(time);
diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingDest.java
similarity index 96%
rename from logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingTest.java
rename to logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingDest.java
index b5f1d59..ae1c5de 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingDest.java
@@ -1,411 +1,412 @@
-/**
- * Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- */
-package ch.qos.logback.core.rolling;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-
-import ch.qos.logback.core.testUtil.RandomUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import ch.qos.logback.core.util.Compare;
-import ch.qos.logback.core.util.CoreTestConstants;
-
-/**
- * A rather exhaustive set of tests. Tests include leaving the file option
- * blank, or setting it, with and without compression, and tests with or without
- * stopping/restarting the RollingFileAppender.
- * <p/>
- * The regression tests log a few times using a RollingFileAppender. Then, they
- * predict the names of the files which should be generated and compare them
- * with witness files.
- * <p/>
- * <pre>
- * Compression file option Stop/Restart
- * Test1 NO BLANK NO
- * Test2 YES BLANK NO
- * Test3 NO BLANK YES
- * Test4 NO SET YES
- * Test5 NO SET NO
- * Test6 YES SET NO
- * </pre>
- *
- * @author Ceki Gülcü
- */
-public class TimeBasedRollingTest extends ScaffoldingForRollingTests {
-
- RollingFileAppender<Object> rfa1 = new RollingFileAppender<Object>();
- TimeBasedRollingPolicy<Object> tbrp1 = new TimeBasedRollingPolicy<Object>();
-
- RollingFileAppender<Object> rfa2 = new RollingFileAppender<Object>();
- TimeBasedRollingPolicy<Object> tbrp2 = new TimeBasedRollingPolicy<Object>();
-
- @Before
- @Override
- public void setUp() {
- super.setUp();
- }
-
- @After
- public void tearDown() {
- }
-
- void initRFA(RollingFileAppender<Object> rfa, String filename) {
- rfa.setContext(context);
- rfa.setEncoder(encoder);
- if (filename != null) {
- rfa.setFile(filename);
- }
- }
-
- void initTRBP(RollingFileAppender<Object> rfa,
- TimeBasedRollingPolicy<Object> tbrp, String filenamePattern,
- long givenTime) {
- tbrp.setContext(context);
- tbrp.setFileNamePattern(filenamePattern);
- tbrp.setParent(rfa);
- tbrp.timeBasedFileNamingAndTriggeringPolicy = new DefaultTimeBasedFileNamingAndTriggeringPolicy<Object>();
- tbrp.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(givenTime);
- rfa.setRollingPolicy(tbrp);
- tbrp.start();
- rfa.start();
- }
-
- /**
- * Test rolling without compression, file option left blank, no stop/start
- */
- @Test
- public void noCompression_FileBlank_NoRestart_1() throws Exception {
- String testId = "test1";
- initRFA(rfa1, null);
- initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
-
- // compute the current filename
- addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
-
- incCurrentTime(1100);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
-
- for (int i = 0; i < 3; i++) {
- rfa1.doAppend("Hello---" + i);
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
- incCurrentTime(500);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- }
-
- int i = 0;
- for (String fn : expectedFilenameList) {
- assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
- + "witness/rolling/tbr-" + testId + "." + i++));
- }
- }
-
- /**
- * With compression, file option left blank, no stop/restart
- */
- @Test
- public void withCompression_FileBlank_NoRestart_2() throws Exception {
- String testId = "test2";
- initRFA(rfa1, null);
- initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}.gz", currentTime);
-
- addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), true);
- incCurrentTime(1100);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
-
- for (int i = 0; i < 3; i++) {
- // when i == 2, file name should not have .gz extension
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, i != 2);
- rfa1.doAppend("Hello---" + i);
- incCurrentTime(500);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- waitForCompression(tbrp1);
- }
-
- int i = 0;
- for (String fn : expectedFilenameList) {
- assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
- + "witness/rolling/tbr-" + testId + "." + i + addGZIfNotLast(i)));
- i++;
- }
- }
-
- /**
- * No compression, file option left blank, with stop/restart,
- */
- @Test
- public void noCompression_FileBlank_StopRestart_3() throws Exception {
- String testId = "test3";
-
- initRFA(rfa1, null);
- initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
-
- // a new file is created by virtue of rfa.start();
- addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
-
- incCurrentTime(1100);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
-
- for (int i = 0; i <= 2; i++) {
- rfa1.doAppend("Hello---" + i);
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
- incCurrentTime(500);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- }
-
- rfa1.stop();
-
- initRFA(rfa2, null);
- initTRBP(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}", tbrp1.timeBasedFileNamingAndTriggeringPolicy
- .getCurrentTime());
-
- for (int i = 0; i <= 2; i++) {
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
- rfa2.doAppend("World---" + i);
- incCurrentTime(100);
- tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- }
-
- int i = 0;
- for (String fn : expectedFilenameList) {
- assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
- + "witness/rolling/tbr-" + testId + "." + i++));
- }
- }
-
- /**
- * Without compression, file option set, with stop/restart
- */
- @Test
- public void noCompression_FileSet_StopRestart_4() throws Exception {
- String testId = "test4";
- initRFA(rfa1, testId2FileName(testId));
- initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
-
- addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
-
- incCurrentTime(1100);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
-
- for (int i = 0; i <= 2; i++) {
- rfa1.doAppend("Hello---" + i);
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
- incCurrentTime(500);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- }
-
- rfa1.stop();
-
- // change the timestamp of the currently actively file
- File activeFile = new File(rfa1.getFile());
- activeFile.setLastModified(currentTime);
-
- initRFA(rfa2, testId2FileName(testId));
- initTRBP(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
-
- for (int i = 0; i <= 2; i++) {
- rfa2.doAppend("World---" + i);
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
- incCurrentTime(100);
- tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- }
-
- System.out.println("Before "+expectedFilenameList);
- massageExpectedFilesToCorresponToCurrentTarget("test4.log");
- System.out.println("After "+expectedFilenameList);
-
-
- int i = 0;
- for (String fn : expectedFilenameList) {
- assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
- + "witness/rolling/tbr-" + testId + "." + i++));
- }
- }
-
- @Test
- public void noCompression_FileSet_StopRestart_WithLongWait_4B()
- throws Exception {
- String testId = "test4B";
- initRFA(rfa1, testId2FileName(testId));
- initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
-
- addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
-
- incCurrentTime(1100);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
-
- for (int i = 0; i <= 2; i++) {
- rfa1.doAppend("Hello---" + i);
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
- incCurrentTime(500);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- }
-
- rfa1.stop();
-
- // change the timestamp of the currently actively file
- File activeFile = new File(rfa1.getFile());
- activeFile.setLastModified(currentTime);
-
- incCurrentTime(2000);
-
- initRFA(rfa2, randomOutputDir + "test4B.log");
- initTRBP(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
-
- for (int i = 0; i <= 2; i++) {
- rfa2.doAppend("World---" + i);
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
- incCurrentTime(100);
- tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- }
-
- massageExpectedFilesToCorresponToCurrentTarget("test4B.log");
-
- int i = 0;
- for (String fn : expectedFilenameList) {
- assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
- + "witness/rolling/tbr-test4B." + i++));
- }
-
- }
-
- /**
- * No compression, file option set, without stop/restart
- */
- @Test
- public void noCompression_FileSet_NoRestart_5() throws Exception {
- String testId = "test5";
-
- initRFA(rfa1, testId2FileName(testId));
- initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
-
- addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
-
- incCurrentTime(1100);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
-
- for (int i = 0; i < 3; i++) {
- rfa1.doAppend("Hello---" + i);
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
- incCurrentTime(500);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- }
-
- massageExpectedFilesToCorresponToCurrentTarget("test5.log");
-
- int i = 0;
- for (String fn : expectedFilenameList) {
- assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
- + "witness/rolling/tbr-test5." + i++));
- }
- }
-
- /**
- * With compression, file option set, no stop/restart,
- */
- @Test
- public void withCompression_FileSet_NoRestart_6() throws Exception {
-
- String testId = "test6";
-
- initRFA(rfa1, testId2FileName(testId));
- initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}.gz", currentTime);
-
- addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), true);
-
- incCurrentTime(1100);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
-
- for (int i = 0; i < 3; i++) {
- rfa1.doAppend("Hello---" + i);
- addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, true);
- incCurrentTime(500);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- waitForCompression(tbrp1);
- }
-
- massageExpectedFilesToCorresponToCurrentTarget("test6.log");
-
- int i = 0;
- for (String fn : expectedFilenameList) {
- assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
- + "witness/rolling/tbr-" + testId + "." + i + addGZIfNotLast(i)));
- i++;
- }
- }
-
- @Test
- public void withMissingTargetDir() throws Exception {
- String testId = "missingTargetDir";
-
- initRFA(rfa1, testId2FileName(testId));
- int secondDiff = RandomUtil.getPositiveInt();
- String randomTargetDir = CoreTestConstants.OUTPUT_DIR_PREFIX + secondDiff + '/';
-
- System.out.println("randomOutputDir"+randomOutputDir);
- System.out.println("randomTargetDir"+randomTargetDir);
-
- initTRBP(rfa1, tbrp1, randomTargetDir + testId + "-%d{"
- + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
-
- addExpectedFileName_ByDate(randomTargetDir, testId, getDateOfCurrentPeriodsStart(), false);
-
- incCurrentTime(1100);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
-
- for (int i = 0; i < 3; i++) {
- rfa1.doAppend("Hello---" + i);
- addExpectedFileNamedIfItsTime_ByDate(randomTargetDir, testId, false);
- incCurrentTime(500);
- tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
- }
- massageExpectedFilesToCorresponToCurrentTarget("missingTargetDir.log");
- int i = 0;
- for (String fn : expectedFilenameList) {
- System.out.println("expectedFile="+fn);
- assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
- + "witness/rolling/tbr-test5." + i++));
- }
-
- }
-
- // =========================================================================
- // utility methods
- // =========================================================================
-
- void massageExpectedFilesToCorresponToCurrentTarget(String file) {
- // we added one too many files by date
- expectedFilenameList.remove(expectedFilenameList.size() - 1);
- // since file is set, we have to add it
- addExpectedFileName_ByFile(file);
- }
-
- void addExpectedFileName_ByFile(String filenameSuffix) {
- String fn = randomOutputDir + filenameSuffix;
- expectedFilenameList.add(fn);
- }
-}
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2011, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.rolling;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import ch.qos.logback.core.testUtil.RandomUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import ch.qos.logback.core.util.Compare;
+import ch.qos.logback.core.util.CoreTestConstants;
+
+/**
+ * A rather exhaustive set of tests. Tests include leaving the file option
+ * blank, or setting it, with and without compression, and tests with or without
+ * stopping/restarting the RollingFileAppender.
+ * <p/>
+ * The regression tests log a few times using a RollingFileAppender. Then, they
+ * predict the names of the files which should be generated and compare them
+ * with witness files.
+ * <p/>
+ * <pre>
+ * Compression file option Stop/Restart
+ * Test1 NO BLANK NO
+ * Test2 YES BLANK NO
+ * Test3 NO BLANK YES
+ * Test4 NO SET YES
+ * Test5 NO SET NO
+ * Test6 YES SET NO
+ * </pre>
+ *
+ * @author Ceki Gülcü
+ * @deprecated replaced by TimeBasedRolling_STest
+ */
+public class TimeBasedRollingDest extends ScaffoldingForRollingTests {
+
+ RollingFileAppender<Object> rfa1 = new RollingFileAppender<Object>();
+ TimeBasedRollingPolicy<Object> tbrp1 = new TimeBasedRollingPolicy<Object>();
+
+ RollingFileAppender<Object> rfa2 = new RollingFileAppender<Object>();
+ TimeBasedRollingPolicy<Object> tbrp2 = new TimeBasedRollingPolicy<Object>();
+
+ @Before
+ @Override
+ public void setUp() {
+ super.setUp();
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ void initRFA(RollingFileAppender<Object> rfa, String filename) {
+ rfa.setContext(context);
+ rfa.setEncoder(encoder);
+ if (filename != null) {
+ rfa.setFile(filename);
+ }
+ }
+
+ void initTRBP(RollingFileAppender<Object> rfa,
+ TimeBasedRollingPolicy<Object> tbrp, String filenamePattern,
+ long givenTime) {
+ tbrp.setContext(context);
+ tbrp.setFileNamePattern(filenamePattern);
+ tbrp.setParent(rfa);
+ tbrp.timeBasedFileNamingAndTriggeringPolicy = new DefaultTimeBasedFileNamingAndTriggeringPolicy<Object>();
+ tbrp.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(givenTime);
+ rfa.setRollingPolicy(tbrp);
+ tbrp.start();
+ rfa.start();
+ }
+
+ /**
+ * Test rolling without compression, file option left blank, no stop/start
+ */
+ @Test
+ public void noCompression_FileBlank_NoRestart_1() throws Exception {
+ String testId = "test1";
+ initRFA(rfa1, null);
+ initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
+
+ // compute the current filename
+ addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
+
+ incCurrentTime(1100);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+
+ for (int i = 0; i < 3; i++) {
+ rfa1.doAppend("Hello---" + i);
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
+ incCurrentTime(500);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ }
+
+ int i = 0;
+ for (String fn : expectedFilenameList) {
+ assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
+ + "witness/rolling/tbr-" + testId + "." + i++));
+ }
+ }
+
+ /**
+ * With compression, file option left blank, no stop/restart
+ */
+ @Test
+ public void withCompression_FileBlank_NoRestart_2() throws Exception {
+ String testId = "test2";
+ initRFA(rfa1, null);
+ initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}.gz", currentTime);
+
+ addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), true);
+ incCurrentTime(1100);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+
+ for (int i = 0; i < 3; i++) {
+ // when i == 2, file name should not have .gz extension
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, i != 2);
+ rfa1.doAppend("Hello---" + i);
+ incCurrentTime(500);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ waitForCompression(tbrp1);
+ }
+
+ int i = 0;
+ for (String fn : expectedFilenameList) {
+ assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
+ + "witness/rolling/tbr-" + testId + "." + i + addGZIfNotLast(i)));
+ i++;
+ }
+ }
+
+ /**
+ * No compression, file option left blank, with stop/restart,
+ */
+ @Test
+ public void noCompression_FileBlank_StopRestart_3() throws Exception {
+ String testId = "test3";
+
+ initRFA(rfa1, null);
+ initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
+
+ // a new file is created by virtue of rfa.start();
+ addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
+
+ incCurrentTime(1100);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+
+ for (int i = 0; i <= 2; i++) {
+ rfa1.doAppend("Hello---" + i);
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
+ incCurrentTime(500);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ }
+
+ rfa1.stop();
+
+ initRFA(rfa2, null);
+ initTRBP(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}", tbrp1.timeBasedFileNamingAndTriggeringPolicy
+ .getCurrentTime());
+
+ for (int i = 0; i <= 2; i++) {
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
+ rfa2.doAppend("World---" + i);
+ incCurrentTime(100);
+ tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ }
+
+ int i = 0;
+ for (String fn : expectedFilenameList) {
+ assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
+ + "witness/rolling/tbr-" + testId + "." + i++));
+ }
+ }
+
+ /**
+ * Without compression, file option set, with stop/restart
+ */
+ @Test
+ public void noCompression_FileSet_StopRestart_4() throws Exception {
+ String testId = "test4";
+ initRFA(rfa1, testId2FileName(testId));
+ initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
+
+ addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
+
+ incCurrentTime(1100);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+
+ for (int i = 0; i <= 2; i++) {
+ rfa1.doAppend("Hello---" + i);
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
+ incCurrentTime(500);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ }
+
+ rfa1.stop();
+
+ // change the timestamp of the currently actively file
+ File activeFile = new File(rfa1.getFile());
+ activeFile.setLastModified(currentTime);
+
+ initRFA(rfa2, testId2FileName(testId));
+ initTRBP(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
+
+ for (int i = 0; i <= 2; i++) {
+ rfa2.doAppend("World---" + i);
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
+ incCurrentTime(100);
+ tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ }
+
+ System.out.println("Before "+expectedFilenameList);
+ massageExpectedFilesToCorresponToCurrentTarget("test4.log");
+ System.out.println("After "+expectedFilenameList);
+
+
+ int i = 0;
+ for (String fn : expectedFilenameList) {
+ assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
+ + "witness/rolling/tbr-" + testId + "." + i++));
+ }
+ }
+
+ @Test
+ public void noCompression_FileSet_StopRestart_WithLongWait_4B()
+ throws Exception {
+ String testId = "test4B";
+ initRFA(rfa1, testId2FileName(testId));
+ initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
+
+ addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
+
+ incCurrentTime(1100);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+
+ for (int i = 0; i <= 2; i++) {
+ rfa1.doAppend("Hello---" + i);
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
+ incCurrentTime(500);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ }
+
+ rfa1.stop();
+
+ // change the timestamp of the currently actively file
+ File activeFile = new File(rfa1.getFile());
+ activeFile.setLastModified(currentTime);
+
+ incCurrentTime(2000);
+
+ initRFA(rfa2, randomOutputDir + "test4B.log");
+ initTRBP(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
+
+ for (int i = 0; i <= 2; i++) {
+ rfa2.doAppend("World---" + i);
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
+ incCurrentTime(100);
+ tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ }
+
+ massageExpectedFilesToCorresponToCurrentTarget("test4B.log");
+
+ int i = 0;
+ for (String fn : expectedFilenameList) {
+ assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
+ + "witness/rolling/tbr-test4B." + i++));
+ }
+
+ }
+
+ /**
+ * No compression, file option set, without stop/restart
+ */
+ @Test
+ public void noCompression_FileSet_NoRestart_5() throws Exception {
+ String testId = "test5";
+
+ initRFA(rfa1, testId2FileName(testId));
+ initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
+
+ addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), false);
+
+ incCurrentTime(1100);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+
+ for (int i = 0; i < 3; i++) {
+ rfa1.doAppend("Hello---" + i);
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false);
+ incCurrentTime(500);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ }
+
+ massageExpectedFilesToCorresponToCurrentTarget("test5.log");
+
+ int i = 0;
+ for (String fn : expectedFilenameList) {
+ assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
+ + "witness/rolling/tbr-test5." + i++));
+ }
+ }
+
+ /**
+ * With compression, file option set, no stop/restart,
+ */
+ @Test
+ public void withCompression_FileSet_NoRestart_6() throws Exception {
+
+ String testId = "test6";
+
+ initRFA(rfa1, testId2FileName(testId));
+ initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}.gz", currentTime);
+
+ addExpectedFileName_ByDate(randomOutputDir, testId, getDateOfCurrentPeriodsStart(), true);
+
+ incCurrentTime(1100);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+
+ for (int i = 0; i < 3; i++) {
+ rfa1.doAppend("Hello---" + i);
+ addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, true);
+ incCurrentTime(500);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ waitForCompression(tbrp1);
+ }
+
+ massageExpectedFilesToCorresponToCurrentTarget("test6.log");
+
+ int i = 0;
+ for (String fn : expectedFilenameList) {
+ assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
+ + "witness/rolling/tbr-" + testId + "." + i + addGZIfNotLast(i)));
+ i++;
+ }
+ }
+
+ @Test
+ public void withMissingTargetDir() throws Exception {
+ String testId = "missingTargetDir";
+
+ initRFA(rfa1, testId2FileName(testId));
+ int secondDiff = RandomUtil.getPositiveInt();
+ String randomTargetDir = CoreTestConstants.OUTPUT_DIR_PREFIX + secondDiff + '/';
+
+ System.out.println("randomOutputDir"+randomOutputDir);
+ System.out.println("randomTargetDir"+randomTargetDir);
+
+ initTRBP(rfa1, tbrp1, randomTargetDir + testId + "-%d{"
+ + DATE_PATTERN_WITH_SECONDS + "}", currentTime);
+
+ addExpectedFileName_ByDate(randomTargetDir, testId, getDateOfCurrentPeriodsStart(), false);
+
+ incCurrentTime(1100);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+
+ for (int i = 0; i < 3; i++) {
+ rfa1.doAppend("Hello---" + i);
+ addExpectedFileNamedIfItsTime_ByDate(randomTargetDir, testId, false);
+ incCurrentTime(500);
+ tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
+ }
+ massageExpectedFilesToCorresponToCurrentTarget("missingTargetDir.log");
+ int i = 0;
+ for (String fn : expectedFilenameList) {
+ System.out.println("expectedFile="+fn);
+ assertTrue(Compare.compare(fn, CoreTestConstants.TEST_DIR_PREFIX
+ + "witness/rolling/tbr-test5." + i++));
+ }
+
+ }
+
+ // =========================================================================
+ // utility methods
+ // =========================================================================
+
+ void massageExpectedFilesToCorresponToCurrentTarget(String file) {
+ // we added one too many files by date
+ expectedFilenameList.remove(expectedFilenameList.size() - 1);
+ // since file is set, we have to add it
+ addExpectedFileName_ByFile(file);
+ }
+
+ void addExpectedFileName_ByFile(String filenameSuffix) {
+ String fn = randomOutputDir + filenameSuffix;
+ expectedFilenameList.add(fn);
+ }
+}
diff --git a/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_STest.scala b/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_STest.scala
index a428f45..e06ef71 100644
--- a/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_STest.scala
+++ b/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemoval_STest.scala
@@ -8,12 +8,12 @@ import ch.qos.logback.core.encoder.EchoEncoder
import java.util.concurrent.TimeUnit
import java.io.{FileFilter, File}
import collection.mutable.ListBuffer
-import java.util.Calendar
import ch.qos.logback.core.util.{StatusPrinter, CoreTestConstants}
import ch.qos.logback.core.CoreConstants._
import java.util.regex.{Matcher, Pattern}
import scala.collection.mutable.{Set, HashSet}
import org.junit.{Ignore, Before, Test}
+import java.util.{Date, Calendar}
/**
* Created by IntelliJ IDEA.
@@ -61,14 +61,15 @@ class TimeBasedRollingWithArchiveRemoval_STest {
def genMontlyRollover(maxHistory: Int, simulatedNumberOfPeriods: Int, startInactivity: Int, numInactivityPeriods: Int) {
slashCount = computeSlashCount(MONTHLY_DATE_PATTERN)
doRollover(now, randomOutputDir + "clean-%d{" + MONTHLY_DATE_PATTERN + "}.txt", MILLIS_IN_MONTH, maxHistory, simulatedNumberOfPeriods, startInactivity, numInactivityPeriods)
- check(expectedCountWithoutFolders(maxHistory))
+ StatusPrinter.print(context)
+ check(expectedCountWithoutFoldersWithInactivity(maxHistory, simulatedNumberOfPeriods, startInactivity+numInactivityPeriods))
}
@Test
def montlyRollover {
- genMontlyRollover(maxHistory = 20, simulatedNumberOfPeriods = 20 * 3, startInactivity = 0, numInactivityPeriods = 0)
- setUp
- genMontlyRollover(maxHistory = 6, simulatedNumberOfPeriods = 70, startInactivity = 30, numInactivityPeriods = 1)
+// genMontlyRollover(maxHistory = 20, simulatedNumberOfPeriods = 20 * 3, startInactivity = 0, numInactivityPeriods = 0)
+// setUp
+// genMontlyRollover(maxHistory = 6, simulatedNumberOfPeriods = 70, startInactivity = 30, numInactivityPeriods = 1)
setUp
genMontlyRollover(maxHistory = 6, simulatedNumberOfPeriods = 10, startInactivity = 3, numInactivityPeriods = 4)
@@ -111,7 +112,6 @@ class TimeBasedRollingWithArchiveRemoval_STest {
var expectedDirMin: Int = 9 + slashCount
var expectDirMax: Int = expectedDirMin + 1 + 1
expectedFileAndDirCount(9, expectedDirMin, expectDirMax)
-
}
@Test def dailySizeBasedRollover {
@@ -181,10 +181,10 @@ class TimeBasedRollingWithArchiveRemoval_STest {
def doRollover(currentTime: Long, fileNamePattern: String, periodDurationInMillis: Long, maxHistory: Int, simulatedNumberOfPeriods: Int, startInactivity: Int = 0, numInactivityPeriods: Int = 0): (Long, Long) = {
val startTime = currentTime
- var rfa: RollingFileAppender[AnyRef] = new RollingFileAppender[AnyRef]
+ val rfa: RollingFileAppender[AnyRef] = new RollingFileAppender[AnyRef]
rfa.setContext(context)
rfa.setEncoder(encoder)
- var tbrp: TimeBasedRollingPolicy[AnyRef] = new TimeBasedRollingPolicy[AnyRef]
+ val tbrp: TimeBasedRollingPolicy[AnyRef] = new TimeBasedRollingPolicy[AnyRef]
tbrp.setContext(context)
tbrp.setFileNamePattern(fileNamePattern)
tbrp.setMaxHistory(maxHistory)
@@ -194,22 +194,23 @@ class TimeBasedRollingWithArchiveRemoval_STest {
tbrp.start
rfa.setRollingPolicy(tbrp)
rfa.start
- var ticksPerPeriod: Int = 512
- var runLength = simulatedNumberOfPeriods * ticksPerPeriod
+ val ticksPerPeriod: Int = 512
+ val runLength = simulatedNumberOfPeriods * ticksPerPeriod
val startInactivityIndex: Int = 1 + startInactivity * ticksPerPeriod
- val endInactivityIndex = startInactivity + numInactivityPeriods * ticksPerPeriod
-
+ val endInactivityIndex = startInactivityIndex + numInactivityPeriods * ticksPerPeriod
+ val tickDuration = periodDurationInMillis / ticksPerPeriod
for (i <- 0 to runLength) {
if (i < startInactivityIndex || i > endInactivityIndex) {
rfa.doAppend("Hello ----------------------------------------------------------" + i)
}
- tbrp.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(addTime(tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime, periodDurationInMillis / ticksPerPeriod))
+ tbrp.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(addTime(tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime, tickDuration))
if (i % (ticksPerPeriod / 2) == 0) {
waitForCompression(tbrp)
}
}
+ println("Last date"+new Date(tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime()));
waitForCompression(tbrp)
rfa.stop
(startTime, tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime)
@@ -219,10 +220,16 @@ class TimeBasedRollingWithArchiveRemoval_STest {
return maxHistory + 1
}
+ def expectedCountWithoutFoldersWithInactivity(maxHistory: Int, totalPeriods: Int, endOfInactivity: Int): Int = {
+ val availableHistory = totalPeriods - endOfInactivity;
+ val actualHistory = scala.math.min(availableHistory, maxHistory+1)
+ return actualHistory
+ }
+
def genericFindMatching(matchFunc: (File, String) => Boolean, dir: File, fileList: ListBuffer[File], pattern: String = null, includeDirs: Boolean = false) {
if (dir.isDirectory) {
- var `match` : Array[File] = dir.listFiles(new FileFilter {
+ val `match` : Array[File] = dir.listFiles(new FileFilter {
def accept(f: File): Boolean = {
return f.isDirectory() || matchFunc(f, pattern)
}
@@ -251,8 +258,8 @@ class TimeBasedRollingWithArchiveRemoval_STest {
def expectedFileAndDirCount(expectedFileAndDirCount: Int, expectedDirCountMin: Int, expectedDirCountMax: Int): Unit = {
- var dir: File = new File(randomOutputDir)
- var fileList = new ListBuffer[File]
+ val dir: File = new File(randomOutputDir)
+ val fileList = new ListBuffer[File]
findFilesInFolderRecursivelyByPatterMatch(dir, fileList, "clean")
var dirList = new ListBuffer[File]
findAllFoldersInFolderRecursively(dir, dirList)
@@ -260,14 +267,14 @@ class TimeBasedRollingWithArchiveRemoval_STest {
}
def check(expectedCount: Int): Unit = {
- var dir: File = new File(randomOutputDir)
+ val dir: File = new File(randomOutputDir)
val fileList = new ListBuffer[File]
findAllDirsOrStringContainsFilesRecursively(dir, fileList, "clean")
assertEquals(expectedCount, fileList.size)
}
def groupByClass(fileList: ListBuffer[File], regex: String): Set[String] = {
- var p: Pattern = Pattern.compile(regex)
+ val p: Pattern = Pattern.compile(regex)
val set = new HashSet[String]
for (f <- fileList) {
var n: String = f.getName
@@ -281,16 +288,16 @@ class TimeBasedRollingWithArchiveRemoval_STest {
}
def checkPatternCompliance(expectedClassCount: Int, regex: String) {
- var dir: File = new File(randomOutputDir)
- var fileList = new ListBuffer[File]
+ val dir: File = new File(randomOutputDir)
+ val fileList = new ListBuffer[File]
findFilesInFolderRecursivelyByPatterMatch(dir, fileList, regex)
- var set: Set[String] = groupByClass(fileList, regex)
+ val set: Set[String] = groupByClass(fileList, regex)
assertEquals(expectedClassCount, set.size)
}
def checkDirPatternCompliance(expectedClassCount: Int): Unit = {
- var dir: File = new File(randomOutputDir)
- var fileList = new ListBuffer[File]
+ val dir: File = new File(randomOutputDir)
+ val fileList = new ListBuffer[File]
findAllFoldersInFolderRecursively(dir, fileList)
for (f <- fileList) {
assertTrue(f.list.length >= 1)
diff --git a/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRolling_STest.scala b/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRolling_STest.scala
index 78a75c7..b7dffd1 100644
--- a/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRolling_STest.scala
+++ b/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRolling_STest.scala
@@ -44,7 +44,8 @@ class TimeBasedRolling_STest extends RollingScaffolding {
}
}
- private def initTRBP(rfa: RollingFileAppender[AnyRef], tbrp: TimeBasedRollingPolicy[AnyRef], filenamePattern: String, givenTime: Long): Unit = {
+ private def initTRBP(rfa: RollingFileAppender[AnyRef], tbrp: TimeBasedRollingPolicy[AnyRef],
+ filenamePattern: String, givenTime: Long): Unit = {
tbrp.setContext(context)
tbrp.setFileNamePattern(filenamePattern)
tbrp.setParent(rfa)
@@ -109,7 +110,6 @@ class TimeBasedRolling_STest extends RollingScaffolding {
val witnessFileName: String = CoreTestConstants.TEST_DIR_PREFIX + "witness/rolling/tbr-" + testId
println(lastFile+" "+witnessFileName)
assertTrue(Compare.compare(lastFile, witnessFileName));
-
}
@@ -179,7 +179,6 @@ class TimeBasedRolling_STest extends RollingScaffolding {
@Test
def failed_rename: Unit = {
-
if(!Env.isWindows) null
var fos: FileOutputStream = null
-----------------------------------------------------------------------
Summary of changes:
...aultTimeBasedFileNamingAndTriggeringPolicy.java | 1 +
...dRollingTest.java => TimeBasedRollingDest.java} | 823 ++++++++++----------
.../TimeBasedRollingWithArchiveRemoval_STest.scala | 53 +-
.../core/rolling/TimeBasedRolling_STest.scala | 5 +-
4 files changed, 445 insertions(+), 437 deletions(-)
rename logback-core/src/test/java/ch/qos/logback/core/rolling/{TimeBasedRollingTest.java => TimeBasedRollingDest.java} (96%)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0
Any chance of getting http://jira.qos.ch/browse/LBCLASSIC-276 / https://github.com/ceki/logback/pull/16 pulled in the near future?
Otherwise I'd do another Lilith release without fully supporting Throwable.getSuppressed().
Joern.
2
5

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-12-g01ae278
by git-noreply@pixie.qos.ch 04 Nov '11
by git-noreply@pixie.qos.ch 04 Nov '11
04 Nov '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 01ae278bdf133e73f7676eebf957d07eca173a03 (commit)
via ccadbcf3824fa4daf2d00411fb00f22bc0fc0672 (commit)
via 05ac03fff7d519b46e1016e2790eaa1269cb1586 (commit)
via 1bb29a6050a471e7b65d97de9a73af7f8d400503 (commit)
from be9513c71eb0ed9869f6269b01dd0151c114a169 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=01ae278bdf133e73f7676eeb…
http://github.com/ceki/logback/commit/01ae278bdf133e73f7676eebf957d07eca173…
commit 01ae278bdf133e73f7676eebf957d07eca173a03
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Fri Nov 4 19:01:04 2011 +0100
typo fix
diff --git a/logback-site/src/site/pages/manual/introduction.html b/logback-site/src/site/pages/manual/introduction.html
index 8fef46f..4c2bc24 100644
--- a/logback-site/src/site/pages/manual/introduction.html
+++ b/logback-site/src/site/pages/manual/introduction.html
@@ -257,7 +257,7 @@ public class HelloWorld2 {
adhere to the conditions of the LGPL license or the EPL license.
</p>
- <p>For building logback udner an IDE, please see the <a
+ <p>For building logback under an IDE, please see the <a
href="../setup.html#ide">relevant section on the class path setup
page</a>.</p>
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=ccadbcf3824fa4daf2d00411…
http://github.com/ceki/logback/commit/ccadbcf3824fa4daf2d00411fb00f22bc0fc0…
commit ccadbcf3824fa4daf2d00411fb00f22bc0fc0672
Merge: be9513c 05ac03f
Author: Jörn Huxhorn <jhuxhorn(a)googlemail.com>
Date: Fri Nov 4 01:17:03 2011 -0700
Merge pull request #16 from huxi/Suppressed
Adding support for Throwable.getSuppressed().
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=05ac03fff7d519b46e1016e2…
http://github.com/ceki/logback/commit/05ac03fff7d519b46e1016e2790eaa1269cb1…
commit 05ac03fff7d519b46e1016e2790eaa1269cb1586
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Mon Jun 13 20:20:07 2011 +0200
Calculating packaging data for suppressed Throwables.
calculate(IThrowableProxy), as expected, needs to support suppressed Throwables, too.
All of this has been tested with Java 7 b145 and is working as expected.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java
index 9e9d7b1..4693579 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/PackagingDataCalculator.java
@@ -56,6 +56,12 @@ public class PackagingDataCalculator {
public void calculate(IThrowableProxy tp) {
while (tp != null) {
populateFrames(tp.getStackTraceElementProxyArray());
+ IThrowableProxy[] suppressed = tp.getSuppressed();
+ if(suppressed != null) {
+ for(IThrowableProxy current:suppressed) {
+ populateFrames(current.getStackTraceElementProxyArray());
+ }
+ }
tp = tp.getCause();
}
}
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=1bb29a6050a471e7b65d97de…
http://github.com/ceki/logback/commit/1bb29a6050a471e7b65d97de9a73af7f8d400…
commit 1bb29a6050a471e7b65d97de9a73af7f8d400503
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Sun Jun 12 16:22:04 2011 +0200
Adding support for Throwable.getSuppressed().
See http://www.oracle.com/technetwork/articles/java/trywithresources-401775.html
- Removed superfluous public from methods in IThrowableProxy interface and added method IThrowableProxy[] getSuppressed().
- Serialized ThrowableProxyVO will be incompatible since suppressed has been added. Consequently, the respective serialVersionUID has been changed.
- ThrowableProxyVO.equals is now also checking suppressed.
- ThrowableProxy is now evaluating suppressed Throwables of its c'tor argument if the Throwable class has a getSuppressed() method, i.e. in case of Java SE 7 and upwards.
This patch is merely adding support of suppressed exceptions to the creation of LoggingEvent/IThrowableProxy. Further support should be added to the following classes:
- ch.qos.logback.classic.db.DBAppender
- ch.qos.logback.classic.html.DefaultThrowableRenderer
- ch.qos.logback.classic.net.SyslogAppender
- ch.qos.logback.classic.pattern.ThrowableProxyConverter
- ch.qos.logback.classic.spi.ThrowableProxyUtil
- method asString
- ch.qos.logback.classic.spi.PackagingDataCalculator
- method calculate(IThrowableProxy tp) may also need to take suppressed into account.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java
index 03e19f1..8e841c8 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/IThrowableProxy.java
@@ -14,9 +14,10 @@
package ch.qos.logback.classic.spi;
public interface IThrowableProxy {
- public String getMessage();
- public String getClassName();
- public StackTraceElementProxy[] getStackTraceElementProxyArray();
- public int getCommonFrames();
- public IThrowableProxy getCause();
-}
\ No newline at end of file
+ String getMessage();
+ String getClassName();
+ StackTraceElementProxy[] getStackTraceElementProxyArray();
+ int getCommonFrames();
+ IThrowableProxy getCause();
+ IThrowableProxy[] getSuppressed();
+}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
index 303ed6e..710e8bb 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxy.java
@@ -15,18 +15,38 @@ package ch.qos.logback.classic.spi;
import ch.qos.logback.core.CoreConstants;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
public class ThrowableProxy implements IThrowableProxy {
- Throwable throwable;
- String className;
- String message;
+ private Throwable throwable;
+ private String className;
+ private String message;
+ // package-private because of ThrowableProxyUtil
StackTraceElementProxy[] stackTraceElementProxyArray;
+ // package-private because of ThrowableProxyUtil
int commonFrames;
- ThrowableProxy cause;
+ private ThrowableProxy cause;
+ private ThrowableProxy[] suppressed=NO_SUPPRESSED;
private transient PackagingDataCalculator packagingDataCalculator;
private boolean calculatedPackageData = false;
+ private static final Method GET_SUPPRESSED_METHOD;
+
+ static {
+ Method method = null;
+ try {
+ method = Throwable.class.getMethod("getSuppressed");
+ } catch (NoSuchMethodException e) {
+ // ignore, will get thrown in Java < 7
+ }
+ GET_SUPPRESSED_METHOD = method;
+ }
+
+ private static final ThrowableProxy[] NO_SUPPRESSED=new ThrowableProxy[0];
+
public ThrowableProxy(Throwable throwable) {
this.throwable = throwable;
@@ -43,6 +63,29 @@ public class ThrowableProxy implements IThrowableProxy {
.findNumberOfCommonFrames(nested.getStackTrace(),
stackTraceElementProxyArray);
}
+ if(GET_SUPPRESSED_METHOD != null) {
+ // this will only execute on Java 7
+ try {
+ Object obj = GET_SUPPRESSED_METHOD.invoke(throwable);
+ if(obj instanceof Throwable[]) {
+ Throwable[] throwableSuppressed = (Throwable[]) obj;
+ if(throwableSuppressed.length > 0) {
+ suppressed = new ThrowableProxy[throwableSuppressed.length];
+ for(int i=0;i<throwableSuppressed.length;i++) {
+ this.suppressed[i] = new ThrowableProxy(throwableSuppressed[i]);
+ this.suppressed[i].commonFrames = ThrowableProxyUtil
+ .findNumberOfCommonFrames(throwableSuppressed[i].getStackTrace(),
+ stackTraceElementProxyArray);
+ }
+ }
+ }
+ } catch (IllegalAccessException e) {
+ // ignore
+ } catch (InvocationTargetException e) {
+ // ignore
+ }
+ }
+
}
@@ -80,6 +123,10 @@ public class ThrowableProxy implements IThrowableProxy {
return cause;
}
+ public IThrowableProxy[] getSuppressed() {
+ return suppressed;
+ }
+
public PackagingDataCalculator getPackagingDataCalculator() {
// if original instance (non-deserialized), and packagingDataCalculator
// is not already initialized, then create an instance.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java
index 34b7769..45b3f7d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyVO.java
@@ -18,13 +18,14 @@ import java.util.Arrays;
public class ThrowableProxyVO implements IThrowableProxy, Serializable {
- private static final long serialVersionUID = 685387990886325422L;
-
+ private static final long serialVersionUID = -773438177285807139L;
+
private String className;
private String message;
private int commonFramesCount;
private StackTraceElementProxy[] stackTraceElementProxyArray;
private IThrowableProxy cause;
+ private IThrowableProxy[] suppressed;
public String getMessage() {
@@ -47,6 +48,10 @@ public class ThrowableProxyVO implements IThrowableProxy, Serializable {
return stackTraceElementProxyArray;
}
+ public IThrowableProxy[] getSuppressed() {
+ return suppressed;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
@@ -75,6 +80,9 @@ public class ThrowableProxyVO implements IThrowableProxy, Serializable {
if (!Arrays.equals(stackTraceElementProxyArray, other.stackTraceElementProxyArray))
return false;
+ if (!Arrays.equals(suppressed, other.suppressed))
+ return false;
+
if (cause == null) {
if (other.cause != null)
return false;
@@ -93,8 +101,16 @@ public class ThrowableProxyVO implements IThrowableProxy, Serializable {
tpvo.message = throwableProxy.getMessage();
tpvo.commonFramesCount = throwableProxy.getCommonFrames();
tpvo.stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray();
- if(throwableProxy.getCause() != null) {
- tpvo.cause = ThrowableProxyVO.build(throwableProxy.getCause());
+ IThrowableProxy cause = throwableProxy.getCause();
+ if(cause != null) {
+ tpvo.cause = ThrowableProxyVO.build(cause);
+ }
+ IThrowableProxy[] suppressed = throwableProxy.getSuppressed();
+ if(suppressed != null) {
+ tpvo.suppressed = new IThrowableProxy[suppressed.length];
+ for(int i = 0;i<suppressed.length;i++) {
+ tpvo.suppressed[i] = ThrowableProxyVO.build(suppressed[i]);
+ }
}
return tpvo;
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java
index c7231ea..b6e48bd 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/DummyThrowableProxy.java
@@ -20,7 +20,7 @@ public class DummyThrowableProxy implements IThrowableProxy {
private int commonFramesCount;
private StackTraceElementProxy[] stackTraceElementProxyArray;
private IThrowableProxy cause;
-
+ private IThrowableProxy[] suppressed;
public String getClassName() {
return className;
@@ -54,8 +54,12 @@ public class DummyThrowableProxy implements IThrowableProxy {
public void setCause(IThrowableProxy cause) {
this.cause = cause;
}
-
-
+ public IThrowableProxy[] getSuppressed() {
+ return suppressed;
+ }
+ public void setSuppressed(IThrowableProxy[] suppressed) {
+ this.suppressed = suppressed;
+ }
}
-----------------------------------------------------------------------
Summary of changes:
.../qos/logback/classic/spi/IThrowableProxy.java | 13 +++--
.../classic/spi/PackagingDataCalculator.java | 6 ++
.../ch/qos/logback/classic/spi/ThrowableProxy.java | 55 ++++++++++++++++++--
.../qos/logback/classic/spi/ThrowableProxyVO.java | 24 +++++++--
.../logback/classic/spi/DummyThrowableProxy.java | 10 +++-
.../src/site/pages/manual/introduction.html | 2 +-
6 files changed, 92 insertions(+), 18 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[JIRA] Created: (LBCLASSIC-304) Moving from log4j to logback classic breaks java.policy.security behavior
by Andrew Bourgeois (JIRA) 04 Nov '11
by Andrew Bourgeois (JIRA) 04 Nov '11
04 Nov '11
Moving from log4j to logback classic breaks java.policy.security behavior
-------------------------------------------------------------------------
Key: LBCLASSIC-304
URL: http://jira.qos.ch/browse/LBCLASSIC-304
Project: logback-classic
Issue Type: Bug
Affects Versions: 1.0.0
Environment: CentOS 5.7
Reporter: Andrew Bourgeois
Assignee: Logback dev list
Hello
Simply replacing the log4j libraries with the logback ones breaks my RMI server at runtime.
Please take the following code:
public static void main(String[] args) throws Exception {
System.setProperty("java.security.policy", "./src/main/config/java.policy");
logger.debug("Policy location: {}", System.getProperty("java.security.policy"));
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
System.setProperty("java.security.policy", "./src/main/config/java.policy");
}
And the following stacktrace:
01:05:37.702 [main] DEBUG be.removed.fun.removed.TestMain - Policy location: ./src/main/config/java.policy
Exception in thread "main" java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.System.setProperty(System.java:725)
at be.removed.fun.removed.TestMain.main(TestMain.java:18)
Somehow logback broke it, I can't even set a property anymore while I was able to read it before (I tested it, reading properties give the same results).
FYI: If I put the "java.policy" file into my $JAVA_HOME/jre/lib/security, the file IS taken into account.
POM.xml before operation:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.0</version>
</dependency>
POM.xml after operation:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.0</version>
</dependency>
Andrew
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
2
6