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

[JIRA] Created: (LBCORE-226) TimeBasedRollingPolicy does not trigger at application startup - MaxHistory not working
by Bruce E. Irving (JIRA) 08 Nov '11
by Bruce E. Irving (JIRA) 08 Nov '11
08 Nov '11
TimeBasedRollingPolicy does not trigger at application startup - MaxHistory not working
---------------------------------------------------------------------------------------
Key: LBCORE-226
URL: http://jira.qos.ch/browse/LBCORE-226
Project: logback-core
Issue Type: Bug
Components: Rolling
Affects Versions: 0.9.30
Environment: Windows XP, Java 1.6.0_27
Reporter: Bruce E. Irving
Assignee: Logback dev list
I am using the RollingFileAppender with TimeBasedRolliingPolicy. The application is a desktop utility that may be run several times per day but is almost never running at midnight when the roll would normally occur.
The log file naming is working correctly - each day's file is date stamped, but the MaxHistory is not working at all since it is not enforced at app startup.
Pertinent config section:
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>MyApp_%d.log</fileNamePattern> <!-- Daily rollover -->
<maxHistory>7</maxHistory> <!-- keep 1 week history -->
</rollingPolicy>
<encoder>
<pattern>%date %-5level [%thread] %logger{10} %msg%n</pattern>
</encoder>
</appender>
I found what I believe is the source of the issue in TimeBasedFileNamingAndTriggeringPolicyBase:
public void start() {
...
setDateInCurrentPeriod(new Date(getCurrentTime()));
if (tbrp.getParentsRawFileProperty() != null) {
File currentFile = new File(tbrp.getParentsRawFileProperty());
if (currentFile.exists() && currentFile.canRead()) {
setDateInCurrentPeriod(new Date(currentFile.lastModified()));
}
}
addInfo("Setting initial period to " + dateInCurrentPeriod);
computeNextCheck();
}
Since there is no parentsRawFileProperty, this uses the current time and sets the next check at midnight tonight. Therefore the check is not run at startup, and in my case is never run. This would work fine if dateInCurrentPeriod was set to anything before today. I would suggest the following change:
public void start() {
...
File currentFile = new File(tbrp.getActiveFileName()); // Use same logic if ParentsRawFileProperty is set or not.
if (currentFile.exists() && currentFile.canRead()) {
setDateInCurrentPeriod(new Date(currentFile.lastModified()));
} else {
setDateInCurrentPeriod(0); // No current file found, force a triggering event
// or if the above is too brute-force: setDateInCurrentPeriod(rc.getRelativeDate(new Date(), -1));
}
addInfo("Setting initial period to " + dateInCurrentPeriod);
computeNextCheck();
}
Note - this was originally reported as a comment on LBCORE-147; moved here to be tracked as a separate issue.
Thanks,
-Bruce
--
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
2

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-48-g14125a6
by git-noreply@pixie.qos.ch 08 Nov '11
by git-noreply@pixie.qos.ch 08 Nov '11
08 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 14125a6b372f8191fb8ab03e1f3838aab642f2ae (commit)
from 458cf00deffe60253799f5c6f6d1ff5954309c80 (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=14125a6b372f8191fb8ab03e…
http://github.com/ceki/logback/commit/14125a6b372f8191fb8ab03e1f3838aab642f…
commit 14125a6b372f8191fb8ab03e1f3838aab642f2ae
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Nov 8 20:15:24 2011 +0100
test LBCORE-226
diff --git a/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java b/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
index 0f61df4..cd58377 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java
@@ -134,4 +134,9 @@ public class ContextBase implements Context {
public ExecutorService getExecutorService() {
return executorService;
}
+
+ @Override
+ public String toString() {
+ return name;
+ }
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
index 0981f1f..0908a2f 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
@@ -93,6 +93,7 @@ public class TimeBasedRollingPolicy<E> extends RollingPolicyBase implements
archiveRemover = timeBasedFileNamingAndTriggeringPolicy.getArchiveRemover();
archiveRemover.setMaxHistory(maxHistory);
if(cleanHistoryOnStart) {
+ addInfo("Cleaning on start up");
archiveRemover.clean(new Date(timeBasedFileNamingAndTriggeringPolicy.getCurrentTime()));
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DefaultArchiveRemover.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DefaultArchiveRemover.java
index 352f5ac..85b494a 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DefaultArchiveRemover.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DefaultArchiveRemover.java
@@ -46,6 +46,7 @@ abstract public class DefaultArchiveRemover extends ContextAwareBase implements
int computeElapsedPeriodsSinceLastClean(long nowInMillis) {
long periodsElapsed = 0;
if (lastHeartBeat == UNINITIALIZED) {
+ addInfo("first clean up after appender initialization");
periodsElapsed = rc.periodsElapsed(nowInMillis, nowInMillis + INACTIVITY_TOLERANCE_IN_MILLIS);
if (periodsElapsed > MAX_VALUE_FOR_INACTIVITY_PERIODS)
periodsElapsed = MAX_VALUE_FOR_INACTIVITY_PERIODS;
@@ -67,7 +68,6 @@ abstract public class DefaultArchiveRemover extends ContextAwareBase implements
addInfo("periodsElapsed = " + periodsElapsed);
}
for (int i = 0; i < periodsElapsed; i++) {
- if (periodsElapsed > 1) addInfo("i = " + i);
cleanByPeriodOffset(now, periodOffsetForDeletionTarget - i);
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java
index 2c65c41..0a2a90b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/TimeBasedArchiveRemover.java
@@ -35,4 +35,8 @@ public class TimeBasedArchiveRemover extends DefaultArchiveRemover {
}
}
}
+
+ public String toString() {
+ return "c.q.l.core.rolling.helper.TimeBasedArchiveRemover";
+ }
}
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 f392cdf..8a5d8ab 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
@@ -61,7 +61,7 @@ class TimeBasedRollingWithArchiveRemoval_STest {
val numPeriods: Int = 40
val maxHistory: Int = 2
val fileNamePattern = randomOutputDir + "/%d{" + MONTHLY_CRONOLOG_DATE_PATTERN + "}/clean.txt.zip"
- val (startTime, endTime) = doRollover(now, fileNamePattern, MILLIS_IN_MONTH, maxHistory, numPeriods)
+ val (startTime, endTime) = logOverMultiplePeriods(now, fileNamePattern, MILLIS_IN_MONTH, maxHistory, numPeriods)
val differenceInMonths = RollingCalendar.diffInMonths(startTime, endTime)
val startTimeAsCalendar = Calendar.getInstance()
startTimeAsCalendar.setTimeInMillis(startTime)
@@ -81,7 +81,7 @@ class TimeBasedRollingWithArchiveRemoval_STest {
def generateDailyRollover(now: Long, maxHistory: Int, simulatedNumberOfPeriods: Int, startInactivity: Int, numInactivityPeriods: Int) {
slashCount = computeSlashCount(DAILY_DATE_PATTERN)
- doRollover(now, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt", MILLIS_IN_DAY, maxHistory, simulatedNumberOfPeriods, startInactivity, numInactivityPeriods)
+ logOverMultiplePeriods(now, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt", MILLIS_IN_DAY, maxHistory, simulatedNumberOfPeriods, startInactivity, numInactivityPeriods)
//StatusPrinter.print(context)
check(expectedCountWithoutFoldersWithInactivity(maxHistory, simulatedNumberOfPeriods, startInactivity + numInactivityPeriods))
}
@@ -110,15 +110,15 @@ class TimeBasedRollingWithArchiveRemoval_STest {
slashCount = computeSlashCount(DAILY_DATE_PATTERN)
val maxHistory = 5
val simulatedNumberOfPeriods = maxHistory * 2
- val (startTime, endTime) = doRollover(now, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt", MILLIS_IN_DAY, maxHistory, maxHistory * 2)
- doRollover(endTime + MILLIS_IN_DAY * 10, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt", MILLIS_IN_DAY, maxHistory, maxHistory)
+ val (startTime, endTime) = logOverMultiplePeriods(now, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt", MILLIS_IN_DAY, maxHistory, maxHistory * 2)
+ logOverMultiplePeriods(endTime + MILLIS_IN_DAY * 10, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt", MILLIS_IN_DAY, maxHistory, maxHistory)
check(expectedCountWithoutFolders(maxHistory))
}
@Test def dailyCronologRollover {
slashCount = computeSlashCount(DAILY_CRONOLOG_DATE_PATTERN)
- doRollover(now, randomOutputDir + "/%d{" + DAILY_CRONOLOG_DATE_PATTERN + "}/clean.txt.zip", MILLIS_IN_DAY, 8, 8 * 3)
+ logOverMultiplePeriods(now, randomOutputDir + "/%d{" + DAILY_CRONOLOG_DATE_PATTERN + "}/clean.txt.zip", MILLIS_IN_DAY, 8, 8 * 3)
var expectedDirMin: Int = 9 + slashCount
var expectDirMax: Int = expectedDirMin + 1 + 1
expectedFileAndDirCount(9, expectedDirMin, expectDirMax)
@@ -129,7 +129,7 @@ class TimeBasedRollingWithArchiveRemoval_STest {
sizeAndTimeBasedFNATP.setMaxFileSize("10000")
tbfnatp = sizeAndTimeBasedFNATP
slashCount = computeSlashCount(DAILY_DATE_PATTERN)
- doRollover(now, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}-clean.%i.zip", MILLIS_IN_DAY, 5, 5 * 4)
+ logOverMultiplePeriods(now, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}-clean.%i.zip", MILLIS_IN_DAY, 5, 5 * 4)
checkPatternCompliance(5 + 1 + slashCount, "\\d{4}-\\d{2}-\\d{2}-clean(\\.\\d)(.zip)?")
}
@@ -138,7 +138,7 @@ class TimeBasedRollingWithArchiveRemoval_STest {
sizeAndTimeBasedFNATP.setMaxFileSize("10000")
tbfnatp = sizeAndTimeBasedFNATP
slashCount = 1
- doRollover(now, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i.zip", MILLIS_IN_DAY, 5, 5 * 4)
+ logOverMultiplePeriods(now, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i.zip", MILLIS_IN_DAY, 5, 5 * 4)
checkDirPatternCompliance(6)
}
@@ -149,21 +149,28 @@ class TimeBasedRollingWithArchiveRemoval_STest {
slashCount = 1
val maxHistory = 5
val simulatedNumberOfPeriods = maxHistory * 4
- val (startTime, endTime) = doRollover(now, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i", MILLIS_IN_DAY, maxHistory, 3)
- doRollover(endTime + MILLIS_IN_DAY * 7, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i", MILLIS_IN_DAY, maxHistory, simulatedNumberOfPeriods)
+ val (startTime, endTime) = logOverMultiplePeriods(now, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i", MILLIS_IN_DAY, maxHistory, 3)
+ logOverMultiplePeriods(endTime + MILLIS_IN_DAY * 7, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i", MILLIS_IN_DAY, maxHistory, simulatedNumberOfPeriods)
checkDirPatternCompliance(maxHistory + 1)
}
- // this test requires changing the current working directory which is impossible in Java
- @Ignore
- @Test def dailyChronologSizeBasedRolloverWhenLogFilenameDoesNotContainDirectory: Unit = {
- var sizeAndTimeBasedFNATP: SizeAndTimeBasedFNATP[AnyRef] = new SizeAndTimeBasedFNATP[AnyRef]
- sizeAndTimeBasedFNATP.setMaxFileSize("10000")
- tbfnatp = sizeAndTimeBasedFNATP
- slashCount = 1
- doRollover(now, "clean.%d{" + DAILY_DATE_PATTERN + "}.%i.zip", MILLIS_IN_DAY, 5, 5 * 4)
- checkDirPatternCompliance(6)
+ def logOncePeriod(currentTime: Long, fileNamePattern: String, maxHistory: Int) = {
+ val (rfa, tbrp) = buildRollingFileAppender(currentTime, fileNamePattern, maxHistory, true)
+ rfa.doAppend("Hello ----------------------------------------------------------" + new Date(currentTime))
+ rfa.stop()
+ }
+
+ @Test def cleanHistoryOnStart {
+ var now = this.now
+ val fileNamePattern = randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt"
+ val maxHistory = 3
+ for (i <- 0 to 5) {
+ logOncePeriod(now, fileNamePattern, maxHistory)
+ now = now + MILLIS_IN_DAY
+ }
+ StatusPrinter.print(context)
+ check(expectedCountWithoutFolders(maxHistory))
}
def extraFolder(numPeriods: Int, periodsPerEra: Int, beginPeriod: Int, maxHistory: Int): Boolean = {
@@ -183,10 +190,8 @@ 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
+ def buildRollingFileAppender(currentTime: Long, fileNamePattern: String, maxHistory: Int,
+ cleanHistoryOnStart: Boolean = false): (RollingFileAppender[AnyRef], TimeBasedRollingPolicy[AnyRef]) = {
val rfa: RollingFileAppender[AnyRef] = new RollingFileAppender[AnyRef]
rfa.setContext(context)
rfa.setEncoder(encoder)
@@ -195,11 +200,20 @@ class TimeBasedRollingWithArchiveRemoval_STest {
tbrp.setFileNamePattern(fileNamePattern)
tbrp.setMaxHistory(maxHistory)
tbrp.setParent(rfa)
+ tbrp.setCleanHistoryOnStart(cleanHistoryOnStart)
tbrp.timeBasedFileNamingAndTriggeringPolicy = tbfnatp
tbrp.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime)
tbrp.start
rfa.setRollingPolicy(tbrp)
rfa.start
+ (rfa, tbrp)
+ }
+
+ def logOverMultiplePeriods(currentTime: Long, fileNamePattern: String, periodDurationInMillis: Long, maxHistory: Int,
+ simulatedNumberOfPeriods: Int, startInactivity: Int = 0,
+ numInactivityPeriods: Int = 0): (Long, Long) = {
+ val startTime = currentTime
+ val (rfa, tbrp) = buildRollingFileAppender(currentTime, fileNamePattern, maxHistory)
val ticksPerPeriod: Int = 512
val runLength = simulatedNumberOfPeriods * ticksPerPeriod
val startInactivityIndex: Int = 1 + startInactivity * ticksPerPeriod
diff --git a/logback-site/src/site/pages/manual/appenders.html b/logback-site/src/site/pages/manual/appenders.html
index 0d997d7..130aebc 100644
--- a/logback-site/src/site/pages/manual/appenders.html
+++ b/logback-site/src/site/pages/manual/appenders.html
@@ -818,6 +818,24 @@ public interface RollingPolicy extends LifeCycle {
archiving will be removed as appropriate.
</td>
</tr>
+
+ <tr class="b">
+ <td><span class="option"><b>cleanHistoryOnStart</b></span></td>
+ <td>boolean</td>
+ <td>
+ <p>If set to true, archive removal will be executed on
+ appender start up. By default this property is set to
+ false. </p>
+
+ <p>Archive removal is normally performed during roll
+ over. However, some applications may not live long enough for
+ roll over to be triggered. It follows that for such
+ short-lived applications archive removal may never get a
+ chance to execute. By setting <span
+ class="option">cleanHistoryOnStart</span> to true, archive
+ removal is performed at appender start up.</p>
+ </td>
+ </tr>
</table>
diff --git a/logback-site/src/site/pages/news.html b/logback-site/src/site/pages/news.html
index 91ec85f..030ada1 100644
--- a/logback-site/src/site/pages/news.html
+++ b/logback-site/src/site/pages/news.html
@@ -31,6 +31,17 @@
<h3>xx of November, 2011 - Release of version 1.0.1</h3>
+ <p>Added new property the <span
+ class="option">cleanHistoryOnStart</span> to <a
+ href="manual/appenders.html#TimeBasedRollingPolicy">TimeBasedRollingPolicy</a>.
+ By setting this property to <code>true</code>, history removal
+ will work as expected even in the case of short lived
+ applications. This fixes <a
+ href="http://jira.qos.ch/browse/LBCORE-226">LBCORE-226</a>
+ reported by Bruce E. Irving.
+ </p>
+
+
<p><code>RequestLogImpl</code> can now lookup for the
logback-access configuration file as a class path resource. This
feature was requested in <a
-----------------------------------------------------------------------
Summary of changes:
.../main/java/ch/qos/logback/core/ContextBase.java | 5 ++
.../core/rolling/TimeBasedRollingPolicy.java | 1 +
.../core/rolling/helper/DefaultArchiveRemover.java | 2 +-
.../rolling/helper/TimeBasedArchiveRemover.java | 4 ++
.../TimeBasedRollingWithArchiveRemoval_STest.scala | 58 ++++++++++++--------
logback-site/src/site/pages/manual/appenders.html | 18 ++++++
logback-site/src/site/pages/news.html | 11 ++++
7 files changed, 76 insertions(+), 23 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-47-g458cf00
by git-noreply@pixie.qos.ch 08 Nov '11
by git-noreply@pixie.qos.ch 08 Nov '11
08 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 458cf00deffe60253799f5c6f6d1ff5954309c80 (commit)
from 9e59ee9e868c51467530824e2f06431234a48477 (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=458cf00deffe60253799f5c6…
http://github.com/ceki/logback/commit/458cf00deffe60253799f5c6f6d1ff5954309…
commit 458cf00deffe60253799f5c6f6d1ff5954309c80
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Nov 8 19:01:14 2011 +0100
minor refactoring
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 9c0e0eb..f392cdf 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
@@ -51,55 +51,61 @@ class TimeBasedRollingWithArchiveRemoval_STest {
else datePattern.foldLeft(0)((count, c) => if (c == '/') count + 1 else count)
}
- def generateDailyRollover(now: Long, maxHistory: Int, simulatedNumberOfPeriods: Int, startInactivity: Int, numInactivityPeriods: Int) {
- slashCount = computeSlashCount(DAILY_DATE_PATTERN)
- doRollover(now, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt", MILLIS_IN_DAY, maxHistory, simulatedNumberOfPeriods, startInactivity, numInactivityPeriods)
- //StatusPrinter.print(context)
- check(expectedCountWithoutFoldersWithInactivity(maxHistory, simulatedNumberOfPeriods, startInactivity + numInactivityPeriods))
- }
-
-
- // Since the duration of a month (in seconds) varies from month to month, tests with inactivity period must
- // be conducted with daily rollover not monthly
- @Test
- def dailyRolloverWithInactivity20 {
- generateDailyRollover(now, maxHistory = 20, simulatedNumberOfPeriods = 20 * 3, startInactivity = 0, numInactivityPeriods = 0)
- }
-
- @Test def dailyRolloverWithInactivity21 {
- generateDailyRollover(now, maxHistory = 6, simulatedNumberOfPeriods = 70, startInactivity = 30, numInactivityPeriods = 1)
- }
-
- @Test def dailyRolloverWithInactivity22 {
- generateDailyRollover(now, maxHistory = 6, simulatedNumberOfPeriods = 10, startInactivity = 3, numInactivityPeriods = 4)
- }
-
// test that the number of files at the end of the test is same as the expected number taking into account end dates
// near the beginning of a new year. This test has been run in a loop with start date varying over a two years
// with success.
@Test def monthlyRolloverOverManyPeriods() {
+
slashCount = computeSlashCount(MONTHLY_CRONOLOG_DATE_PATTERN)
val numPeriods: Int = 40
val maxHistory: Int = 2
-
- val (startTime, endTime) = doRollover(now, randomOutputDir + "/%d{" + MONTHLY_CRONOLOG_DATE_PATTERN + "}/clean.txt.zip", MILLIS_IN_MONTH, maxHistory, numPeriods)
+ val fileNamePattern = randomOutputDir + "/%d{" + MONTHLY_CRONOLOG_DATE_PATTERN + "}/clean.txt.zip"
+ val (startTime, endTime) = doRollover(now, fileNamePattern, MILLIS_IN_MONTH, maxHistory, numPeriods)
val differenceInMonths = RollingCalendar.diffInMonths(startTime, endTime)
val startTimeAsCalendar = Calendar.getInstance()
startTimeAsCalendar.setTimeInMillis(startTime)
val indexOfStartPeriod: Int = startTimeAsCalendar.get(Calendar.MONTH)
val withExtraFolder = extraFolder(differenceInMonths, MONTHS_IN_YEAR, indexOfStartPeriod, maxHistory)
+
+ def expectedCountWithFolders(): Int = {
+ val numLogFiles = (maxHistory + 1)
+ val numLogFilesAndFolders = numLogFiles * 2
+ var result: Int = numLogFilesAndFolders + slashCount
+ if (withExtraFolder) result += 1
+ result
+ }
//StatusPrinter.print(context)
- check(expectedCountWithFolders(maxHistory, withExtraFolder))
+ check(expectedCountWithFolders())
}
- @Test def dailyRollover {
+ def generateDailyRollover(now: Long, maxHistory: Int, simulatedNumberOfPeriods: Int, startInactivity: Int, numInactivityPeriods: Int) {
slashCount = computeSlashCount(DAILY_DATE_PATTERN)
- doRollover(now, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt.zip", MILLIS_IN_DAY, 5, 5 * 3, startInactivity = 6, numInactivityPeriods = 3)
- StatusPrinter.print(context)
- check(expectedCountWithoutFolders(5))
+ doRollover(now, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt", MILLIS_IN_DAY, maxHistory, simulatedNumberOfPeriods, startInactivity, numInactivityPeriods)
+ //StatusPrinter.print(context)
+ check(expectedCountWithoutFoldersWithInactivity(maxHistory, simulatedNumberOfPeriods, startInactivity + numInactivityPeriods))
+ }
+
+ @Test
+ def basicDailyRollover {
+ generateDailyRollover(now, maxHistory = 20, simulatedNumberOfPeriods = 20 * 3, startInactivity = 0, numInactivityPeriods = 0)
+ }
+
+ // Since the duration of a month (in seconds) varies from month to month, tests with inactivity period must
+ // be conducted with daily rollover not monthly
+ @Test def dailyRollover15 {
+ generateDailyRollover(now, maxHistory = 5, simulatedNumberOfPeriods = 15, startInactivity = 6, numInactivityPeriods = 3)
+ }
+
+ @Test def dailyRolloverWithInactivity70 {
+ generateDailyRollover(now, maxHistory = 6, simulatedNumberOfPeriods = 70, startInactivity = 30, numInactivityPeriods = 1)
}
+ @Test def dailyRolloverWithInactivity10 {
+ generateDailyRollover(now, maxHistory = 6, simulatedNumberOfPeriods = 10, startInactivity = 3, numInactivityPeriods = 4)
+ }
+
+
@Test def dailyRolloverWithSecondPhase {
slashCount = computeSlashCount(DAILY_DATE_PATTERN)
val maxHistory = 5
@@ -166,13 +172,6 @@ class TimeBasedRollingWithArchiveRemoval_STest {
return (valueOfLastMonth < maxHistory)
}
- def expectedCountWithFolders(maxHistory: Int, extraFolder: Boolean): Int = {
- val numLogFiles = (maxHistory + 1)
- val numLogFilesAndFolders = numLogFiles * 2
- var result: Int = numLogFilesAndFolders + slashCount
- if (extraFolder) result += 1
- result
- }
def addTime(currentTime: Long, timeToWait: Long): Long = {
return currentTime + timeToWait
@@ -184,7 +183,9 @@ class TimeBasedRollingWithArchiveRemoval_STest {
}
}
- def doRollover(currentTime: Long, fileNamePattern: String, periodDurationInMillis: Long, maxHistory: Int, simulatedNumberOfPeriods: Int, startInactivity: Int = 0, numInactivityPeriods: Int = 0): (Long, Long) = {
+ def doRollover(currentTime: Long, fileNamePattern: String, periodDurationInMillis: Long, maxHistory: Int,
+ simulatedNumberOfPeriods: Int, startInactivity: Int = 0,
+ numInactivityPeriods: Int = 0): (Long, Long) = {
val startTime = currentTime
val rfa: RollingFileAppender[AnyRef] = new RollingFileAppender[AnyRef]
rfa.setContext(context)
-----------------------------------------------------------------------
Summary of changes:
.../TimeBasedRollingWithArchiveRemoval_STest.scala | 77 ++++++++++----------
1 files changed, 39 insertions(+), 38 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-46-g9e59ee9
by git-noreply@pixie.qos.ch 08 Nov '11
by git-noreply@pixie.qos.ch 08 Nov '11
08 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 9e59ee9e868c51467530824e2f06431234a48477 (commit)
via fc93571b93062ee4087940abc1f376de42aed9e4 (commit)
via 9d864bcdc7fae385e4184fa4ceaf114e26718f9b (commit)
via 71f69c3dc42ce286ab9c8c93385f0801bdb1791f (commit)
via 245fd65da02ab5a82cb66ae388e56450889eee6f (commit)
via 9931dfeb2af2e7f629056758772f44c39a43fe99 (commit)
via 6860c6f5a7e844f213acb222d4c13f5583734cac (commit)
from 525e3196ee203d2fafe4535a29374dacf7ca90e1 (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=9e59ee9e868c51467530824e…
http://github.com/ceki/logback/commit/9e59ee9e868c51467530824e2f06431234a48…
commit 9e59ee9e868c51467530824e2f06431234a48477
Merge: 525e319 fc93571
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Nov 8 18:19:42 2011 +0100
Merge branch 'master' of github.com:ceki/logback
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=fc93571b93062ee4087940ab…
http://github.com/ceki/logback/commit/fc93571b93062ee4087940abc1f376de42aed…
commit fc93571b93062ee4087940abc1f376de42aed9e4
Merge: cc3ed1a 9d864bc
Author: Jörn Huxhorn <jhuxhorn(a)googlemail.com>
Date: Tue Nov 8 07:44:40 2011 -0800
Merge pull request #33 from ceki/suppressed
Suppressed support in ThrowableProxyUtil.
Updated according to Cekis suggestions.
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=9d864bcdc7fae385e4184fa4…
http://github.com/ceki/logback/commit/9d864bcdc7fae385e4184fa4ceaf114e26718…
commit 9d864bcdc7fae385e4184fa4ceaf114e26718f9b
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Tue Nov 8 16:38:52 2011 +0100
Added constants for magic values and deprecated unused subjoinSTEPArray method.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
index 67c3b1b..b89457e 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
@@ -23,6 +23,9 @@ import ch.qos.logback.core.CoreConstants;
*/
public class ThrowableProxyUtil {
+ public static final int REGULAR_EXCEPTION_INDENT = 1;
+ public static final int SUPPRESSED_EXCEPTION_INDENT = 2;
+
public static void build(ThrowableProxy nestedTP, Throwable nestedThrowable,
ThrowableProxy parentTP) {
@@ -75,7 +78,7 @@ public class ThrowableProxyUtil {
public static String asString(IThrowableProxy tp) {
StringBuilder sb = new StringBuilder();
- recursiveAppend(sb, null, 1, tp);
+ recursiveAppend(sb, null, REGULAR_EXCEPTION_INDENT, tp);
return sb.toString();
}
@@ -89,10 +92,10 @@ public class ThrowableProxyUtil {
IThrowableProxy[] suppressed = tp.getSuppressed();
if(suppressed != null) {
for(IThrowableProxy current : suppressed) {
- recursiveAppend(sb, CoreConstants.SUPPRESSED, 2, current);
+ recursiveAppend(sb, CoreConstants.SUPPRESSED, SUPPRESSED_EXCEPTION_INDENT, current);
}
}
- recursiveAppend(sb, CoreConstants.CAUSED_BY, 1, tp.getCause());
+ recursiveAppend(sb, CoreConstants.CAUSED_BY, REGULAR_EXCEPTION_INDENT, tp.getCause());
}
private static void subjoinFirstLine(StringBuilder buf, String prefix, IThrowableProxy tp) {
@@ -123,11 +126,21 @@ public class ThrowableProxyUtil {
subjoinPackagingData(sb, step);
}
- // not called anymore - but it is public
+ /**
+ * @param sb The StringBuilder the STEPs are appended to.
+ * @param tp the IThrowableProxy containing the STEPs.
+ * @deprecated Use subjoinSTEPArray(StringBuilder sb, int indentLevel, IThrowableProxy tp) instead.
+ */
public static void subjoinSTEPArray(StringBuilder sb, IThrowableProxy tp) {
- subjoinSTEPArray(sb, 1, tp);
+ // not called anymore - but it is public
+ subjoinSTEPArray(sb, REGULAR_EXCEPTION_INDENT, tp);
}
+ /**
+ * @param sb The StringBuilder the STEPs are appended to.
+ * @param indentLevel indentation level used for the STEPs, usually either REGULAR_EXCEPTION_INDENT or SUPPRESSED_EXCEPTION_INDENT.
+ * @param tp the IThrowableProxy containing the STEPs.
+ */
private static void subjoinSTEPArray(StringBuilder sb, int indentLevel, IThrowableProxy tp) {
StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
int commonFrames = tp.getCommonFrames();
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=71f69c3dc42ce286ab9c8c93…
http://github.com/ceki/logback/commit/71f69c3dc42ce286ab9c8c93385f0801bdb17…
commit 71f69c3dc42ce286ab9c8c93385f0801bdb1791f
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Sat Nov 5 03:53:34 2011 +0100
Added suppressed-support to asString
Also added two tests that are only executed if running on Java 7.
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
index 8d76786..67c3b1b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ThrowableProxyUtil.java
@@ -23,7 +23,7 @@ import ch.qos.logback.core.CoreConstants;
*/
public class ThrowableProxyUtil {
- static public void build(ThrowableProxy nestedTP, Throwable nestedThrowable,
+ public static void build(ThrowableProxy nestedTP, Throwable nestedThrowable,
ThrowableProxy parentTP) {
StackTraceElement[] nestedSTE = nestedThrowable.getStackTrace();
@@ -72,18 +72,36 @@ public class ThrowableProxyUtil {
return count;
}
- static public String asString(IThrowableProxy tp) {
+ public static String asString(IThrowableProxy tp) {
StringBuilder sb = new StringBuilder();
- while (tp != null) {
- subjoinFirstLine(sb, tp);
- sb.append(CoreConstants.LINE_SEPARATOR);
- subjoinSTEPArray(sb, tp);
- tp = tp.getCause();
- }
+ recursiveAppend(sb, null, 1, tp);
+
return sb.toString();
}
+ private static void recursiveAppend(StringBuilder sb, String prefix, int indent, IThrowableProxy tp) {
+ if(tp == null)
+ return;
+ subjoinFirstLine(sb, prefix, tp);
+ sb.append(CoreConstants.LINE_SEPARATOR);
+ subjoinSTEPArray(sb, indent, tp);
+ IThrowableProxy[] suppressed = tp.getSuppressed();
+ if(suppressed != null) {
+ for(IThrowableProxy current : suppressed) {
+ recursiveAppend(sb, CoreConstants.SUPPRESSED, 2, current);
+ }
+ }
+ recursiveAppend(sb, CoreConstants.CAUSED_BY, 1, tp.getCause());
+ }
+
+ private static void subjoinFirstLine(StringBuilder buf, String prefix, IThrowableProxy tp) {
+ if (prefix != null) {
+ buf.append(prefix);
+ }
+ subjoinExceptionMessage(buf, tp);
+ }
+
public static void subjoinPackagingData(StringBuilder builder, StackTraceElementProxy step) {
if (step != null) {
ClassPackagingData cpd = step.getClassPackagingData();
@@ -100,30 +118,40 @@ public class ThrowableProxyUtil {
}
}
- static public void subjoinSTEP(StringBuilder sb, StackTraceElementProxy step) {
+ public static void subjoinSTEP(StringBuilder sb, StackTraceElementProxy step) {
sb.append(step.toString());
subjoinPackagingData(sb, step);
}
-
- static public void subjoinSTEPArray(StringBuilder sb, IThrowableProxy tp) {
+
+ // not called anymore - but it is public
+ public static void subjoinSTEPArray(StringBuilder sb, IThrowableProxy tp) {
+ subjoinSTEPArray(sb, 1, tp);
+ }
+
+ private static void subjoinSTEPArray(StringBuilder sb, int indentLevel, IThrowableProxy tp) {
StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
int commonFrames = tp.getCommonFrames();
for (int i = 0; i < stepArray.length - commonFrames; i++) {
StackTraceElementProxy step = stepArray[i];
- sb.append(CoreConstants.TAB);
+ for(int j = 0; j < indentLevel ; j++) {
+ sb.append(CoreConstants.TAB);
+ }
subjoinSTEP(sb, step);
sb.append(CoreConstants.LINE_SEPARATOR);
}
if (commonFrames > 0) {
- sb.append("\t... ").append(commonFrames).append(" common frames omitted")
+ for(int j = 0; j < indentLevel ; j++) {
+ sb.append(CoreConstants.TAB);
+ }
+ sb.append("... ").append(commonFrames).append(" common frames omitted")
.append(CoreConstants.LINE_SEPARATOR);
}
}
- static public void subjoinFirstLine(StringBuilder buf, IThrowableProxy tp) {
+ public static void subjoinFirstLine(StringBuilder buf, IThrowableProxy tp) {
int commonFrames = tp.getCommonFrames();
if (commonFrames > 0) {
buf.append(CoreConstants.CAUSED_BY);
@@ -131,7 +159,7 @@ public class ThrowableProxyUtil {
subjoinExceptionMessage(buf, tp);
}
- static public void subjoinFirstLineRootCauseFirst(StringBuilder buf, IThrowableProxy tp) {
+ public static void subjoinFirstLineRootCauseFirst(StringBuilder buf, IThrowableProxy tp) {
if (tp.getCause() != null) {
buf.append(CoreConstants.WRAPPED_BY);
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java
index 1c485e6..d5ff824 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/ThrowableProxyTest.java
@@ -14,9 +14,12 @@
package ch.qos.logback.classic.spi;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeNotNull;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import org.junit.After;
import org.junit.Before;
@@ -27,6 +30,25 @@ public class ThrowableProxyTest {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
+ private static final Method ADD_SUPPRESSED_METHOD;
+
+ static {
+ Method method = null;
+ try {
+ method = Throwable.class.getMethod("addSuppressed", Throwable.class);
+ } catch (NoSuchMethodException e) {
+ // ignore, will get thrown in Java < 7
+ }
+ ADD_SUPPRESSED_METHOD = method;
+ }
+
+ private static void addSuppressed(Throwable outer, Throwable suppressed) throws InvocationTargetException, IllegalAccessException
+ {
+ if(ADD_SUPPRESSED_METHOD != null) {
+ ADD_SUPPRESSED_METHOD.invoke(outer, suppressed);
+ }
+ }
+
@Before
public void setUp() throws Exception {
}
@@ -71,6 +93,40 @@ public class ThrowableProxyTest {
verify(w);
}
+ @Test
+ public void suppressed() throws InvocationTargetException, IllegalAccessException
+ {
+ assumeNotNull(ADD_SUPPRESSED_METHOD); // only execute on Java 7, would work anyway but doesn't make sense.
+ Exception ex = null;
+ try {
+ someMethod();
+ } catch (Exception e) {
+ Exception fooException = new Exception("Foo");
+ Exception barException = new Exception("Bar");
+ addSuppressed(e, fooException);
+ addSuppressed(e, barException);
+ ex = e;
+ }
+ verify(ex);
+ }
+
+ @Test
+ public void suppressedWithCause() throws InvocationTargetException, IllegalAccessException
+ {
+ assumeNotNull(ADD_SUPPRESSED_METHOD); // only execute on Java 7, would work anyway but doesn't make sense.
+ Exception ex = null;
+ try {
+ someMethod();
+ } catch (Exception e) {
+ ex=new Exception("Wrapper", e);
+ Exception fooException = new Exception("Foo");
+ Exception barException = new Exception("Bar");
+ addSuppressed(ex, fooException);
+ addSuppressed(e, barException);
+ }
+ verify(ex);
+ }
+
// see also http://jira.qos.ch/browse/LBCLASSIC-216
@Test
public void nullSTE() {
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=245fd65da02ab5a82cb66ae3…
http://github.com/ceki/logback/commit/245fd65da02ab5a82cb66ae388e56450889ee…
commit 245fd65da02ab5a82cb66ae388e56450889eee6f
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Sat Nov 5 03:51:33 2011 +0100
Updated to JUnit 4.10
diff --git a/pom.xml b/pom.xml
index f72f1e0..6f88e10 100755
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
<!-- slf4j.version property is used below, in
logback-classic/pom.xml and in setClasspath.cmd -->
<slf4j.version>1.6.4</slf4j.version>
- <junit.version>4.8.2</junit.version>
+ <junit.version>4.10</junit.version>
<janino.version>2.5.10</janino.version>
<scala.version>2.9.1</scala.version>
<groovy.version>1.7.6</groovy.version>
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=9931dfeb2af2e7f629056758…
http://github.com/ceki/logback/commit/9931dfeb2af2e7f629056758772f44c39a43f…
commit 9931dfeb2af2e7f629056758772f44c39a43fe99
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Sat Nov 5 03:51:06 2011 +0100
Added *.ipr and *.iws IDEA files to .gitignore
diff --git a/.gitignore b/.gitignore
index 7e52e85..5e32982 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,6 @@ target
.project
.idea
*~
-*.iml
\ No newline at end of file
+*.iml
+*.ipr
+*.iws
\ No newline at end of file
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=6860c6f5a7e844f213acb222…
http://github.com/ceki/logback/commit/6860c6f5a7e844f213acb222d4c13f5583734…
commit 6860c6f5a7e844f213acb222d4c13f5583734cac
Author: Joern Huxhorn <jhuxhorn(a)googlemail.com>
Date: Sat Nov 5 03:49:13 2011 +0100
Added SUPPRESSED constant.
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 713879d..cfb3e86 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
@@ -69,6 +69,7 @@ public class CoreConstants {
*/
public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[]{};
public static final String CAUSED_BY = "Caused by: ";
+ public static final String SUPPRESSED = "\tSuppressed: ";
public static final String WRAPPED_BY = "Wrapped by: ";
public static final char PERCENT_CHAR = '%';
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 4 +-
.../logback/classic/spi/ThrowableProxyUtil.java | 71 +++++++++++++++----
.../logback/classic/spi/ThrowableProxyTest.java | 56 +++++++++++++++
.../java/ch/qos/logback/core/CoreConstants.java | 1 +
pom.xml | 2 +-
5 files changed, 117 insertions(+), 17 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-39-g525e319
by git-noreply@pixie.qos.ch 08 Nov '11
by git-noreply@pixie.qos.ch 08 Nov '11
08 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 525e3196ee203d2fafe4535a29374dacf7ca90e1 (commit)
from cc3ed1a36afc3070ac23c57ad02b3ddbb4dc8cd3 (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=525e3196ee203d2fafe4535a…
http://github.com/ceki/logback/commit/525e3196ee203d2fafe4535a29374dacf7ca9…
commit 525e3196ee203d2fafe4535a29374dacf7ca90e1
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Nov 8 18:18:25 2011 +0100
tests with inactivity periods must be done with daily rollover
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 e06ef71..9c0e0eb 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
@@ -15,14 +15,6 @@ import scala.collection.mutable.{Set, HashSet}
import org.junit.{Ignore, Before, Test}
import java.util.{Date, Calendar}
-/**
- * Created by IntelliJ IDEA.
- * User: ceki
- * Date: 29.08.11
- * Time: 18:08
- * To change this template use File | Settings | File Templates.
- */
-
class TimeBasedRollingWithArchiveRemoval_STest {
var context: Context = new ContextBase
var encoder: EchoEncoder[AnyRef] = new EchoEncoder[AnyRef]
@@ -35,7 +27,8 @@ class TimeBasedRollingWithArchiveRemoval_STest {
val MILLIS_IN_MINUTE: Long = 60 * 1000
val MILLIS_IN_HOUR: Long = 60 * MILLIS_IN_MINUTE
val MILLIS_IN_DAY: Long = 24 * MILLIS_IN_HOUR
- val MILLIS_IN_MONTH: Long = ((365.0 / 12) * MILLIS_IN_DAY).asInstanceOf[Long]
+ val MILLIS_IN_MONTH: Long = ((365.242199 / 12) * MILLIS_IN_DAY).asInstanceOf[Long]
+ val MONTHS_IN_YEAR = 12
var diff: Int = _
var randomOutputDir: String = _
@@ -58,35 +51,46 @@ class TimeBasedRollingWithArchiveRemoval_STest {
else datePattern.foldLeft(0)((count, c) => if (c == '/') count + 1 else count)
}
- 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)
- StatusPrinter.print(context)
- check(expectedCountWithoutFoldersWithInactivity(maxHistory, simulatedNumberOfPeriods, startInactivity+numInactivityPeriods))
+ def generateDailyRollover(now: Long, maxHistory: Int, simulatedNumberOfPeriods: Int, startInactivity: Int, numInactivityPeriods: Int) {
+ slashCount = computeSlashCount(DAILY_DATE_PATTERN)
+ doRollover(now, randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt", MILLIS_IN_DAY, maxHistory, simulatedNumberOfPeriods, startInactivity, numInactivityPeriods)
+ //StatusPrinter.print(context)
+ check(expectedCountWithoutFoldersWithInactivity(maxHistory, simulatedNumberOfPeriods, startInactivity + numInactivityPeriods))
}
+
+ // Since the duration of a month (in seconds) varies from month to month, tests with inactivity period must
+ // be conducted with daily rollover not monthly
@Test
- def montlyRollover {
-// 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)
+ def dailyRolloverWithInactivity20 {
+ generateDailyRollover(now, maxHistory = 20, simulatedNumberOfPeriods = 20 * 3, startInactivity = 0, numInactivityPeriods = 0)
+ }
+ @Test def dailyRolloverWithInactivity21 {
+ generateDailyRollover(now, maxHistory = 6, simulatedNumberOfPeriods = 70, startInactivity = 30, numInactivityPeriods = 1)
}
- @Test def monthlyRolloverOverManyPeriods {
- System.out.println("randomOutputDir=" + randomOutputDir)
+ @Test def dailyRolloverWithInactivity22 {
+ generateDailyRollover(now, maxHistory = 6, simulatedNumberOfPeriods = 10, startInactivity = 3, numInactivityPeriods = 4)
+ }
+
+
+ // test that the number of files at the end of the test is same as the expected number taking into account end dates
+ // near the beginning of a new year. This test has been run in a loop with start date varying over a two years
+ // with success.
+ @Test def monthlyRolloverOverManyPeriods() {
slashCount = computeSlashCount(MONTHLY_CRONOLOG_DATE_PATTERN)
- var numPeriods: Int = 40
- var maxHistory: Int = 2
+ val numPeriods: Int = 40
+ val maxHistory: Int = 2
val (startTime, endTime) = doRollover(now, randomOutputDir + "/%d{" + MONTHLY_CRONOLOG_DATE_PATTERN + "}/clean.txt.zip", MILLIS_IN_MONTH, maxHistory, numPeriods)
val differenceInMonths = RollingCalendar.diffInMonths(startTime, endTime)
- var indexOfStartPeriod: Int = Calendar.getInstance.get(Calendar.MONTH)
- val withExtraFolder = extraFolder(differenceInMonths, 12, indexOfStartPeriod, maxHistory)
- StatusPrinter.print(context)
- check(expectedCountWithFolders(2, withExtraFolder))
+ val startTimeAsCalendar = Calendar.getInstance()
+ startTimeAsCalendar.setTimeInMillis(startTime)
+ val indexOfStartPeriod: Int = startTimeAsCalendar.get(Calendar.MONTH)
+ val withExtraFolder = extraFolder(differenceInMonths, MONTHS_IN_YEAR, indexOfStartPeriod, maxHistory)
+ //StatusPrinter.print(context)
+ check(expectedCountWithFolders(maxHistory, withExtraFolder))
}
@Test def dailyRollover {
@@ -140,8 +144,8 @@ class TimeBasedRollingWithArchiveRemoval_STest {
val maxHistory = 5
val simulatedNumberOfPeriods = maxHistory * 4
val (startTime, endTime) = doRollover(now, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i", MILLIS_IN_DAY, maxHistory, 3)
- doRollover(endTime+MILLIS_IN_DAY*7, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i", MILLIS_IN_DAY, maxHistory, simulatedNumberOfPeriods)
- checkDirPatternCompliance(maxHistory+1)
+ doRollover(endTime + MILLIS_IN_DAY * 7, randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i", MILLIS_IN_DAY, maxHistory, simulatedNumberOfPeriods)
+ checkDirPatternCompliance(maxHistory + 1)
}
@@ -157,6 +161,7 @@ class TimeBasedRollingWithArchiveRemoval_STest {
}
def extraFolder(numPeriods: Int, periodsPerEra: Int, beginPeriod: Int, maxHistory: Int): Boolean = {
+ println("numPeriods=" + numPeriods + ", beginPeriod=" + beginPeriod + ", maxHistory=" + maxHistory)
var valueOfLastMonth: Int = ((beginPeriod) + numPeriods) % periodsPerEra
return (valueOfLastMonth < maxHistory)
}
@@ -175,7 +180,7 @@ class TimeBasedRollingWithArchiveRemoval_STest {
def waitForCompression(tbrp: TimeBasedRollingPolicy[AnyRef]): Unit = {
if (tbrp.future != null && !tbrp.future.isDone) {
- tbrp.future.get(800, TimeUnit.MILLISECONDS)
+ tbrp.future.get(1000, TimeUnit.MILLISECONDS)
}
}
@@ -210,7 +215,7 @@ class TimeBasedRollingWithArchiveRemoval_STest {
}
}
- println("Last date"+new Date(tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime()));
+ println("Last date" + new Date(tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime()));
waitForCompression(tbrp)
rfa.stop
(startTime, tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime)
@@ -221,8 +226,8 @@ class TimeBasedRollingWithArchiveRemoval_STest {
}
def expectedCountWithoutFoldersWithInactivity(maxHistory: Int, totalPeriods: Int, endOfInactivity: Int): Int = {
- val availableHistory = totalPeriods - endOfInactivity;
- val actualHistory = scala.math.min(availableHistory, maxHistory+1)
+ val availableHistory = (totalPeriods + 1) - endOfInactivity;
+ val actualHistory = scala.math.min(availableHistory, maxHistory + 1)
return actualHistory
}
@@ -261,9 +266,10 @@ class TimeBasedRollingWithArchiveRemoval_STest {
val dir: File = new File(randomOutputDir)
val fileList = new ListBuffer[File]
findFilesInFolderRecursivelyByPatterMatch(dir, fileList, "clean")
- var dirList = new ListBuffer[File]
+ val dirList = new ListBuffer[File]
findAllFoldersInFolderRecursively(dir, dirList)
- assertTrue("expectedDirCountMin=" + expectedDirCountMin + ", expectedDirCountMax=" + expectedDirCountMax + " actual value=" + dirList.size, expectedDirCountMin <= dirList.size && dirList.size <= expectedDirCountMax)
+ val msg = "expectedDirCountMin=" + expectedDirCountMin + ", expectedDirCountMax=" + expectedDirCountMax + " actual value=" + dirList.size
+ assertTrue(msg, expectedDirCountMin <= dirList.size && dirList.size <= expectedDirCountMax)
}
def check(expectedCount: Int): Unit = {
@@ -277,11 +283,11 @@ class TimeBasedRollingWithArchiveRemoval_STest {
val p: Pattern = Pattern.compile(regex)
val set = new HashSet[String]
for (f <- fileList) {
- var n: String = f.getName
- var m: Matcher = p.matcher(n)
+ val n: String = f.getName
+ val m: Matcher = p.matcher(n)
m.matches
- var begin: Int = m.start(1)
- var reduced: String = n.substring(0, begin)
+ val begin: Int = m.start(1)
+ val reduced: String = n.substring(0, begin)
set.add(reduced)
}
return set
-----------------------------------------------------------------------
Summary of changes:
.../TimeBasedRollingWithArchiveRemoval_STest.scala | 86 +++++++++++---------
1 files changed, 46 insertions(+), 40 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-38-gcc3ed1a
by git-noreply@pixie.qos.ch 08 Nov '11
by git-noreply@pixie.qos.ch 08 Nov '11
08 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 cc3ed1a36afc3070ac23c57ad02b3ddbb4dc8cd3 (commit)
via 90ae7a93d0aa60b87f3926022ae7fd52608c7e2c (commit)
via f0d6bc500761b104b9f947cafa2d5b3753ae5639 (commit)
via 6c0b65493bdd41513a6f8be58f0bbf313725de8d (commit)
via 7f28864991abd0643640bf5664ec7df08293e2ca (commit)
via 7fba75491fc15a3424062d5228126312258f070f (commit)
via 8cd1a0ef2bcfd92ea2fbdd678d15323fed614f3a (commit)
from 58de50e302d443c0d9d0d9a8e2fbcadba14f5391 (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=cc3ed1a36afc3070ac23c57a…
http://github.com/ceki/logback/commit/cc3ed1a36afc3070ac23c57ad02b3ddbb4dc8…
commit cc3ed1a36afc3070ac23c57ad02b3ddbb4dc8cd3
Merge: 58de50e 90ae7a9
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Nov 8 13:43:01 2011 +0100
Merge branch 'master' of github.com:ceki/logback
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=90ae7a93d0aa60b87f392602…
http://github.com/ceki/logback/commit/90ae7a93d0aa60b87f3926022ae7fd52608c7…
commit 90ae7a93d0aa60b87f3926022ae7fd52608c7e2c
Merge: f0d6bc5 8cd1a0e
Author: Jörn Huxhorn <jhuxhorn(a)googlemail.com>
Date: Tue Nov 8 02:11:20 2011 -0800
Merge pull request #28 from nurkiewicz/LBCLASSIC-217-fix
Correct 0.9.30 version in @since tag
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=f0d6bc500761b104b9f947ca…
http://github.com/ceki/logback/commit/f0d6bc500761b104b9f947cafa2d5b3753ae5…
commit f0d6bc500761b104b9f947cafa2d5b3753ae5639
Merge: a2f83e8 6c0b654
Author: Jörn Huxhorn <jhuxhorn(a)googlemail.com>
Date: Tue Nov 8 02:07:13 2011 -0800
Merge pull request #34 from motlin/master
Three fixes from static-analysis tools.
Reviewed changes.
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=6c0b65493bdd41513a6f8be5…
http://github.com/ceki/logback/commit/6c0b65493bdd41513a6f8be58f0bbf313725d…
commit 6c0b65493bdd41513a6f8be58f0bbf313725de8d
Author: Craig P. Motlin <cmotlin(a)gmail.com>
Date: Mon Nov 7 23:10:40 2011 -0500
Remove redundant 'final' method in 'final' 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 acd5750..354f4e6 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
@@ -95,14 +95,14 @@ public final class Level implements java.io.Serializable {
/**
* Returns the string representation of this Level.
*/
- public final String toString() {
+ public String toString() {
return levelStr;
}
/**
* Returns the integer representation of this Level.
*/
- public final int toInt() {
+ public int toInt() {
return levelInt;
}
@@ -111,7 +111,7 @@ public final class Level implements java.io.Serializable {
*
* @return This level's Integer mapping.
*/
- public final Integer toInteger() {
+ public Integer toInteger() {
switch (levelInt) {
case ALL_INT:
return ALL_INTEGER;
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 500a9d3..8301c3b 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
@@ -114,7 +114,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
buildRemoteView();
}
- public final Level getEffectiveLevel() {
+ public Level getEffectiveLevel() {
return Level.toLevel(effectiveLevelInt);
}
@@ -474,7 +474,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
filterAndLog_0_Or3Plus(FQCN, null, Level.TRACE, msg, null, null);
}
- public final void trace(String format, Object arg) {
+ public void trace(String format, Object arg) {
filterAndLog_1(FQCN, null, Level.TRACE, format, arg, null);
}
@@ -490,7 +490,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
filterAndLog_0_Or3Plus(FQCN, null, Level.TRACE, msg, null, t);
}
- public final void trace(Marker marker, String msg) {
+ public void trace(Marker marker, String msg) {
filterAndLog_0_Or3Plus(FQCN, marker, Level.TRACE, msg, null, null);
}
@@ -510,11 +510,11 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
filterAndLog_0_Or3Plus(FQCN, marker, Level.TRACE, msg, null, t);
}
- public final boolean isDebugEnabled() {
+ public boolean isDebugEnabled() {
return isDebugEnabled(null);
}
- public final boolean isDebugEnabled(Marker marker) {
+ public 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,
}
}
- public final void debug(String msg) {
+ public void debug(String msg) {
filterAndLog_0_Or3Plus(FQCN, null, Level.DEBUG, msg, null, null);
}
- public final void debug(String format, Object arg) {
+ public void debug(String format, Object arg) {
filterAndLog_1(FQCN, null, Level.DEBUG, format, arg, null);
}
- public final void debug(String format, Object arg1, Object arg2) {
+ public void debug(String format, Object arg1, Object arg2) {
filterAndLog_2(FQCN, null, Level.DEBUG, format, arg1, arg2, null);
}
- public final void debug(String format, Object[] argArray) {
+ public void debug(String format, Object[] argArray) {
filterAndLog_0_Or3Plus(FQCN, null, Level.DEBUG, format, argArray, null);
}
@@ -547,7 +547,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
filterAndLog_0_Or3Plus(FQCN, null, Level.DEBUG, msg, null, t);
}
- public final void debug(Marker marker, String msg) {
+ public void debug(Marker marker, String msg) {
filterAndLog_0_Or3Plus(FQCN, marker, Level.DEBUG, msg, null, null);
}
@@ -664,7 +664,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
filterAndLog_0_Or3Plus(FQCN, marker, Level.INFO, msg, null, t);
}
- public final boolean isTraceEnabled() {
+ public boolean isTraceEnabled() {
return isTraceEnabled(null);
}
@@ -681,7 +681,7 @@ public final class Logger implements org.slf4j.Logger, LocationAwareLogger,
}
}
- public final boolean isErrorEnabled() {
+ public boolean isErrorEnabled() {
return isErrorEnabled(null);
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java
index c0f41a5..df1de73 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/TurboFilterList.java
@@ -36,7 +36,7 @@ final public class TurboFilterList extends CopyOnWriteArrayList<TurboFilter> {
* ACCEPT or DENY, then that value is returned. If all of the filters return
* NEUTRAL, then NEUTRAL is returned.
*/
- public final FilterReply getTurboFilterChainDecision(final Marker marker,
+ public FilterReply getTurboFilterChainDecision(final Marker marker,
final Logger logger, final Level level, final String format,
final Object[] params, final Throwable t) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/helpers/NOPAppender.java b/logback-core/src/main/java/ch/qos/logback/core/helpers/NOPAppender.java
index 2be5f93..ebda3d1 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/helpers/NOPAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/helpers/NOPAppender.java
@@ -18,7 +18,6 @@ import ch.qos.logback.core.AppenderBase;
final public class NOPAppender<E> extends AppenderBase<E> {
@Override
- final protected void append(E eventObject) {
+ protected void append(E eventObject) {
}
}
-
\ No newline at end of file
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=7f28864991abd0643640bf56…
http://github.com/ceki/logback/commit/7f28864991abd0643640bf5664ec7df08293e…
commit 7f28864991abd0643640bf5664ec7df08293e2ca
Author: Craig P. Motlin <cmotlin(a)gmail.com>
Date: Mon Nov 7 22:47:51 2011 -0500
Remove redundant local variables.
diff --git a/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java b/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java
index 6bae974..e3a25bc 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/ViewStatusMessagesServlet.java
@@ -29,9 +29,8 @@ public class ViewStatusMessagesServlet extends ViewStatusMessagesServletBase {
HttpServletResponse resp) {
ServletContext sc = getServletContext();
- StatusManager result = (StatusManager) sc
+ return (StatusManager) sc
.getAttribute(AccessConstants.LOGBACK_STATUS_MANAGER_KEY);
- return result;
// if (result != null) {
// System.out.println("from ServletContext");
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/gaffer/GafferUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/gaffer/GafferUtil.java
index 011699f..e5d121a 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/gaffer/GafferUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/gaffer/GafferUtil.java
@@ -49,8 +49,7 @@ public class GafferUtil {
try {
Class gcClass = Class.forName(ClassicConstants.GAFFER_CONFIGURATOR_FQCN);
Constructor c = gcClass.getConstructor(LoggerContext.class);
- GafferConfigurator gafferConfigurator = (GafferConfigurator) c.newInstance(loggerContext);
- return gafferConfigurator;
+ return (GafferConfigurator) c.newInstance(loggerContext);
} catch (ClassNotFoundException e) {
addError(loggerContext, origin, ERROR_MSG, e);
} catch (NoSuchMethodException e) {
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/MBeanUtil.java b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/MBeanUtil.java
index 5047087..07d0ba7 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/jmx/MBeanUtil.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/jmx/MBeanUtil.java
@@ -28,9 +28,8 @@ public class MBeanUtil {
static final String DOMAIN = "ch.qos.logback.classic";
static public String getObjectNameFor(String contextName, Class type) {
- String objectNameAsStr = DOMAIN + ":Name=" + contextName + ",Type="
+ return DOMAIN + ":Name=" + contextName + ",Type="
+ type.getName();
- return objectNameAsStr;
}
public static ObjectName string2ObjectName(Context context, Object caller,
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java
index 7a98dfd..920e689 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java
@@ -44,10 +44,9 @@ public class RootCauseFirstThrowableProxyConverter extends ExtendedThrowableProx
int commonFrames = tp.getCommonFrames();
boolean unrestrictedPrinting = lengthOption > stepArray.length;
- int length = (unrestrictedPrinting) ? stepArray.length : lengthOption;
- int maxIndex = length;
+ int maxIndex = (unrestrictedPrinting) ? stepArray.length : lengthOption;
if (commonFrames > 0 && unrestrictedPrinting) {
maxIndex -= commonFrames;
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
index ba71f6d..593b30e 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java
@@ -154,10 +154,9 @@ public class ThrowableProxyConverter extends ThrowableHandlingConverter {
int commonFrames = tp.getCommonFrames();
boolean unrestrictedPrinting = lengthOption > stepArray.length;
- int length = (unrestrictedPrinting) ? stepArray.length : lengthOption;
- int maxIndex = length;
+ int maxIndex = (unrestrictedPrinting) ? stepArray.length : lengthOption;
if (commonFrames > 0 && unrestrictedPrinting) {
maxIndex -= commonFrames;
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/CopyOnInheritThreadLocal.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/CopyOnInheritThreadLocal.java
index c7e034f..689195d 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/CopyOnInheritThreadLocal.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/CopyOnInheritThreadLocal.java
@@ -33,8 +33,7 @@ public class CopyOnInheritThreadLocal extends
if (parentValue == null) {
return null;
} else {
- HashMap<String, String> hm = new HashMap<String, String>(parentValue);
- return hm;
+ return new HashMap<String, String>(parentValue);
}
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/boolex/JaninoEventEvaluatorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/boolex/JaninoEventEvaluatorTest.java
index 02e5ba7..b04cf69 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/boolex/JaninoEventEvaluatorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/boolex/JaninoEventEvaluatorTest.java
@@ -59,10 +59,9 @@ public class JaninoEventEvaluatorTest {
}
LoggingEvent makeLoggingEvent(Exception ex) {
- LoggingEvent e = new LoggingEvent(
+ return new LoggingEvent(
ch.qos.logback.core.pattern.FormattingConverter.class.getName(),
logger, Level.INFO, "Some message", ex, null);
- return e;
}
@Test
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/corpus/CorpusModel.java b/logback-classic/src/test/java/ch/qos/logback/classic/corpus/CorpusModel.java
index dbac6ac..5abe4fc 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/corpus/CorpusModel.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/corpus/CorpusModel.java
@@ -242,9 +242,8 @@ public class CorpusModel {
throwableProxy = ThrowableProxyVO.build(new ThrowableProxy(t));
pupulateWithPackagingData(throwableProxy.getStackTraceElementProxyArray());
}
- LogStatement logStatement = new LogStatement(loggerName, randomLevel, mat,
+ return new LogStatement(loggerName, randomLevel, mat,
throwableProxy);
- return logStatement;
}
private Throwable getRandomThrowable(Level level) {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java
index ff13db7..b90a616 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2Test.java
@@ -202,9 +202,8 @@ public class DBAppenderH2Test {
private ILoggingEvent createLoggingEvent(String msg, Object[] args) {
- ILoggingEvent le = new LoggingEvent(this.getClass().getName(), logger,
+ return new LoggingEvent(this.getClass().getName(), logger,
Level.DEBUG, msg, new Exception("test Ex"), args);
- return le;
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java
index ce00928..8da98af 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTest.java
@@ -178,11 +178,10 @@ public class DBAppenderHSQLTest {
rs.close();
stmt.close();
}
-
+
private ILoggingEvent createLoggingEvent() {
- ILoggingEvent le = new LoggingEvent(this.getClass().getName(), logger,
- Level.DEBUG, "test message", new Exception("test Ex"), new Integer[] {diff});
- return le;
+ return new LoggingEvent(this.getClass().getName(), logger,
+ Level.DEBUG, "test message", new Exception("test Ex"), new Integer[]{diff});
}
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
index 955970d..a881c48 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/html/HTMLLayoutTest.java
@@ -215,9 +215,8 @@ public class HTMLLayoutTest {
}
private LoggingEvent createLoggingEvent() {
- LoggingEvent le = new LoggingEvent(this.getClass().getName(), root,
+ return new LoggingEvent(this.getClass().getName(), root,
Level.DEBUG, "test message", null, null);
- return le;
}
Document parseOutput(String output) throws Exception {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java
index 37ce6f7..3baa23a 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ExtendedThrowableProxyConverterTest.java
@@ -50,10 +50,9 @@ public class ExtendedThrowableProxyConverterTest {
}
private ILoggingEvent createLoggingEvent(Throwable t) {
- ILoggingEvent le = new LoggingEvent(this.getClass().getName(), lc
+ return new LoggingEvent(this.getClass().getName(), lc
.getLogger(Logger.ROOT_LOGGER_NAME), Level.DEBUG, "test message", t,
null);
- return le;
}
@Test
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
index febe9d5..5881e4f 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
@@ -70,9 +70,8 @@ public class MDCConverterTest {
}
private ILoggingEvent createLoggingEvent() {
- ILoggingEvent le = new LoggingEvent(this.getClass().getName(), lc
+ return new LoggingEvent(this.getClass().getName(), lc
.getLogger(Logger.ROOT_LOGGER_NAME), Level.DEBUG, "test message", null,
null);
- return le;
}
}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ThrowableProxyConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ThrowableProxyConverterTest.java
index cbe18df..4b63b98 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ThrowableProxyConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ThrowableProxyConverterTest.java
@@ -47,10 +47,9 @@ public class ThrowableProxyConverterTest {
}
private ILoggingEvent createLoggingEvent(Throwable t) {
- ILoggingEvent le = new LoggingEvent(this.getClass().getName(), lc
+ return new LoggingEvent(this.getClass().getName(), lc
.getLogger(Logger.ROOT_LOGGER_NAME), Level.DEBUG, "test message", t,
null);
- return le;
}
@Test
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
index 3f2bdb9..2d73426 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/LoggingEventSerializationTest.java
@@ -184,9 +184,8 @@ public class LoggingEventSerializationTest {
}
private LoggingEvent createLoggingEvent() {
- LoggingEvent le = new LoggingEvent(this.getClass().getName(), logger,
+ return new LoggingEvent(this.getClass().getName(), logger,
Level.DEBUG, "test message", null, null);
- return le;
}
private void checkForEquality(ILoggingEvent original,
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackagingDataCalculatorTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackagingDataCalculatorTest.java
index c7b1fc9..385dcfd 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackagingDataCalculatorTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/spi/PackagingDataCalculatorTest.java
@@ -101,9 +101,8 @@ public class PackagingDataCalculatorTest {
private ClassLoader makeBogusClassLoader() throws MalformedURLException {
ClassLoader currentClassLoader = this.getClass().getClassLoader();
- BogusClassLoader bcl = new BogusClassLoader(new URL[] {},
+ return new BogusClassLoader(new URL[] {},
currentClassLoader);
- return bcl;
}
@Test
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 3ec7234..b8c425d 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
@@ -55,8 +55,7 @@ public class FileAppender<E> extends OutputStreamAppender<E> {
} else {
// Trim spaces from both ends. The users probably does not want
// trailing spaces in file names.
- String val = file.trim();
- fileName = val;
+ fileName = file.trim();
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java b/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java
index c863e33..5089a47 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/action/Action.java
@@ -22,18 +22,18 @@ import ch.qos.logback.core.joran.spi.Interpreter;
import ch.qos.logback.core.spi.ContextAwareBase;
/**
- *
+ *
* Most of the work for configuring logback is done by Actions.
- *
+ *
* <p>Action methods are invoked as the XML file is parsed.
- *
+ *
* <p>This class is largely inspired from the relevant class in the
* commons-digester project of the Apache Software Foundation.
- *
+ *
* @author Craig McClanahan
* @author Christopher Lenz
* @author Ceki Gülcü
- *
+ *
*/
public abstract class Action extends ContextAwareBase {
@@ -96,8 +96,7 @@ public abstract class Action extends ContextAwareBase {
}
protected String getLineColStr(InterpretationContext ic) {
- String line = "line: " + getLineNumber(ic) + ", column: "
+ return "line: " + getLineNumber(ic) + ", column: "
+ getColumnNumber(ic);
- return line;
}
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConfigurationWatchList.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConfigurationWatchList.java
index c134ecc..6e70d22 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConfigurationWatchList.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConfigurationWatchList.java
@@ -85,8 +85,7 @@ public class ConfigurationWatchList extends ContextAwareBase {
File convertToFile(URL url) {
String protocol = url.getProtocol();
if ("file".equals(protocol)) {
- File file = new File(URLDecoder.decode(url.getFile()));
- return file;
+ return new File(URLDecoder.decode(url.getFile()));
} else {
addInfo("URL [" + url + "] is not of type file");
return null;
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/util/PropertySetter.java b/logback-core/src/main/java/ch/qos/logback/core/joran/util/PropertySetter.java
index 3ab2be7..3adc7a0 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/joran/util/PropertySetter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/util/PropertySetter.java
@@ -200,8 +200,7 @@ public class PropertySetter extends ContextAwareBase {
private Method findAdderMethod(String name) {
name = capitalizeFirstLetter(name);
- Method adderMethod = getMethod("add" + name);
- return adderMethod;
+ return getMethod("add" + name);
}
private Method findSetterMethod(String name) {
@@ -451,8 +450,7 @@ public class PropertySetter extends ContextAwareBase {
DefaultClass defaultClassAnnon = getAnnotation(name, DefaultClass.class,
relevantMethod);
if (defaultClassAnnon != null) {
- Class defaultClass = defaultClassAnnon.value();
- return defaultClass;
+ return defaultClassAnnon.value();
}
return null;
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/FileFilterUtil.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/FileFilterUtil.java
index 329ba8b..7e5da7b 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/FileFilterUtil.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/FileFilterUtil.java
@@ -80,12 +80,11 @@ public class FileFilterUtil {
if (!file.exists() || !file.isDirectory()) {
return new File[0];
}
- File[] matchingFileArray = file.listFiles(new FilenameFilter() {
+ return file.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.matches(stemRegex);
}
});
- return matchingFileArray;
}
static public int findHighestCounter(File[] matchingFileArray, final String stemRegex) {
@@ -108,8 +107,7 @@ public class FileFilterUtil {
+ "] should match [" + lastFileName + "]");
}
String counterAsStr = m.group(1);
- int counter = new Integer(counterAsStr).intValue();
- return counter;
+ return new Integer(counterAsStr).intValue();
}
public static String slashify(String in) {
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 855eb33..17df862 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
@@ -67,8 +67,7 @@ public class CyclicBufferTrackerImpl<E> implements CyclicBufferTracker<E> {
public CyclicBuffer<E> getOrCreate(String key, long timestamp) {
Entry existing = map.get(key);
if (existing == null) {
- CyclicBuffer<E> cb = processNewEntry(key, timestamp);
- return cb;
+ return processNewEntry(key, timestamp);
} else {
existing.setTimestamp(timestamp);
moveToTail(existing);
diff --git a/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilience_AS_ROOT_Test.java b/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilience_AS_ROOT_Test.java
index ec65198..9b778ca 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilience_AS_ROOT_Test.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/FileAppenderResilience_AS_ROOT_Test.java
@@ -132,7 +132,6 @@ public class FileAppenderResilience_AS_ROOT_Test {
}
ProcessBuilder pb = new ProcessBuilder();
pb.command("/usr/bin/sudo", PATH_LOOPFS_SCRIPT, cmd.toString());
- Process process = pb.start();
- return process;
+ return pb.start();
}
}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/spi/CaseCombinator.java b/logback-core/src/test/java/ch/qos/logback/core/joran/spi/CaseCombinator.java
index 0602b6e..fce697c 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/joran/spi/CaseCombinator.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/spi/CaseCombinator.java
@@ -69,8 +69,7 @@ public class CaseCombinator {
return c;
}
if ('a' <= c && c <= 'z') {
- int ci = c;
- return (char) (ci + 'A' - 'a');
+ return (char) ((int) c + 'A' - 'a');
}
// code should never reach this point
return c;
@@ -81,8 +80,7 @@ public class CaseCombinator {
return c;
}
if ('A' <= c && c <= 'Z') {
- int ci = c;
- return (char) (ci + 'a' - 'A');
+ return (char) ((int) c + 'a' - 'A');
}
// code should never reach this point
return c;
diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java
index 8e056e2..8144137 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/MultiThreadedRollingTest.java
@@ -131,8 +131,7 @@ public class MultiThreadedRollingTest {
}
OutputStream openScript() throws IOException {
- FileOutputStream fos = new FileOutputStream(outputDirStr + VERIFY_SH);
- return fos;
+ return new FileOutputStream(outputDirStr + VERIFY_SH);
}
@Test
diff --git a/logback-core/src/test/java/ch/qos/logback/core/sift/Simulator.java b/logback-core/src/test/java/ch/qos/logback/core/sift/Simulator.java
index 207cea5..745b865 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/sift/Simulator.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/sift/Simulator.java
@@ -63,8 +63,7 @@ public class Simulator {
private String getRandomKeyStr() {
int ri = randomKeyGen.nextInt();
- String s = String.format("%X", ri);
- return s;
+ return String.format("%X", ri);
}
void buildScenario(int simLen) {
diff --git a/logback-core/src/test/java/ch/qos/logback/core/spi/CyclicBufferTrackerSimulator.java b/logback-core/src/test/java/ch/qos/logback/core/spi/CyclicBufferTrackerSimulator.java
index 847044c..e521295 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/spi/CyclicBufferTrackerSimulator.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/spi/CyclicBufferTrackerSimulator.java
@@ -48,8 +48,7 @@ public class CyclicBufferTrackerSimulator {
private String getRandomKeyStr() {
int ri = randomKeyGen.nextInt();
- String s = String.format("%X", ri);
- return s;
+ return String.format("%X", ri);
}
void buildScenario(int simLen) {
diff --git a/logback-core/src/test/java/ch/qos/logback/core/util/Compare.java b/logback-core/src/test/java/ch/qos/logback/core/util/Compare.java
index a9b890d..536c1ba 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/util/Compare.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/util/Compare.java
@@ -37,8 +37,7 @@ public class Compare {
static BufferedReader gzFileToBufferedReader(String file) throws IOException {
FileInputStream fis = new FileInputStream(file);
GZIPInputStream gzis = new GZIPInputStream(fis);
- BufferedReader br = new BufferedReader(new InputStreamReader(gzis));
- return br;
+ return new BufferedReader(new InputStreamReader(gzis));
}
public static boolean gzFileCompare(String file1, String file2) throws IOException {
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=7fba75491fc15a3424062d52…
http://github.com/ceki/logback/commit/7fba75491fc15a3424062d5228126312258f0…
commit 7fba75491fc15a3424062d5228126312258f070f
Author: Craig P. Motlin <cmotlin(a)gmail.com>
Date: Mon Nov 7 22:15:56 2011 -0500
Remove redundant no-arg constructors.
diff --git a/logback-access/src/main/java/ch/qos/logback/access/boolex/JaninoEventEvaluator.java b/logback-access/src/main/java/ch/qos/logback/access/boolex/JaninoEventEvaluator.java
index 4e5f7c0..674889a 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/boolex/JaninoEventEvaluator.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/boolex/JaninoEventEvaluator.java
@@ -32,10 +32,6 @@ public class JaninoEventEvaluator extends JaninoEventEvaluatorBase<IAccessEvent>
}
- public JaninoEventEvaluator() {
-
- }
-
protected String getDecoratedExpression() {
String expression = getExpression();
if (!expression.contains("return")) {
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 3008d70..0e91dc7 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
@@ -66,9 +66,6 @@ public class DBAppender extends DBAppenderBase<IAccessEvent> {
GET_GENERATED_KEYS_METHOD = getGeneratedKeysMethod;
}
- public DBAppender() {
- }
-
@Override
protected void subAppend(IAccessEvent event, Connection connection,
PreparedStatement insertStatement) throws Throwable {
diff --git a/logback-access/src/main/java/ch/qos/logback/access/html/DefaultCssBuilder.java b/logback-access/src/main/java/ch/qos/logback/access/html/DefaultCssBuilder.java
index 3979fd7..bec5c28 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/html/DefaultCssBuilder.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/html/DefaultCssBuilder.java
@@ -25,9 +25,6 @@ import ch.qos.logback.core.html.CssBuilder;
*/
public class DefaultCssBuilder implements CssBuilder {
- public DefaultCssBuilder() {
- }
-
public void addCss(StringBuilder sbuf) {
sbuf.append("<style type=\"text/css\">");
sbuf.append("table{ ");
diff --git a/logback-access/src/main/java/ch/qos/logback/access/html/UrlCssBuilder.java b/logback-access/src/main/java/ch/qos/logback/access/html/UrlCssBuilder.java
index 3a89525..aea01f6 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/html/UrlCssBuilder.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/html/UrlCssBuilder.java
@@ -27,9 +27,6 @@ public class UrlCssBuilder implements CssBuilder {
String url = "http://logback.qos.ch/css/access.css";
- public UrlCssBuilder() {
- }
-
public String getUrl() {
return url;
}
diff --git a/logback-access/src/main/java/ch/qos/logback/access/net/URLEvaluator.java b/logback-access/src/main/java/ch/qos/logback/access/net/URLEvaluator.java
index d60ba37..e638a8f 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/net/URLEvaluator.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/net/URLEvaluator.java
@@ -28,9 +28,6 @@ public class URLEvaluator extends ContextAwareBase implements EventEvaluator, Li
String name;
private List<String> URLList = new ArrayList<String>();
- public URLEvaluator() {
- }
-
public void addURL(String url) {
URLList.add(url);
}
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 ea2c904..af911a0 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
@@ -73,10 +73,6 @@ public class JaninoEventEvaluator extends
DEFAULT_PARAM_TYPE_LIST.add(Throwable.class);
}
- public JaninoEventEvaluator() {
-
- }
-
protected String getDecoratedExpression() {
String expression = getExpression();
if(!expression.contains("return")) {
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 5842d93..5e8baae 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
@@ -79,9 +79,6 @@ public class DBAppender extends DBAppenderBase<ILoggingEvent> {
GET_GENERATED_KEYS_METHOD = getGeneratedKeysMethod;
}
- public DBAppender() {
- }
-
public void setDbNameResolver(DBNameResolver dbNameResolver) {
this.dbNameResolver = dbNameResolver;
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultCssBuilder.java b/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultCssBuilder.java
index 8afbc63..f81ddb4 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultCssBuilder.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultCssBuilder.java
@@ -27,9 +27,6 @@ import ch.qos.logback.core.html.CssBuilder;
*/
public class DefaultCssBuilder implements CssBuilder {
- public DefaultCssBuilder() {
- }
-
public void addCss(StringBuilder sbuf) {
sbuf.append("<style type=\"text/css\">");
sbuf.append(LINE_SEPARATOR);
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java b/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java
index 742cbc6..c2ec351 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/html/DefaultThrowableRenderer.java
@@ -25,9 +25,6 @@ public class DefaultThrowableRenderer implements
static final String TRACE_PREFIX = "<br /> ";
- public DefaultThrowableRenderer() {
- }
-
public void render(StringBuilder sbuf, ILoggingEvent event) {
IThrowableProxy tp = event.getThrowableProxy();
sbuf.append("<tr><td class=\"Exception\" colspan=\"6\">");
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/html/UrlCssBuilder.java b/logback-classic/src/main/java/ch/qos/logback/classic/html/UrlCssBuilder.java
index 911f319..2ddf8c6 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/html/UrlCssBuilder.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/html/UrlCssBuilder.java
@@ -27,9 +27,6 @@ public class UrlCssBuilder implements CssBuilder {
String url = "http://logback.qos.ch/css/classic.css";
- public UrlCssBuilder() {
- }
-
public String getUrl() {
return url;
}
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java b/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
index 46c8f73..8a34efc 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/joran/JoranConfigurator.java
@@ -35,9 +35,6 @@ import ch.qos.logback.core.joran.spi.RuleStore;
*/
public class JoranConfigurator extends JoranConfiguratorBase {
- public JoranConfigurator() {
- }
-
@Override
public void addInstanceRules(RuleStore rs) {
// parent rules already added
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java
index 70c456c..90de734 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSQueueAppender.java
@@ -53,9 +53,6 @@ public class JMSQueueAppender extends JMSAppenderBase<ILoggingEvent> {
private PreSerializationTransformer<ILoggingEvent> pst = new LoggingEventPreSerializationTransformer();
- public JMSQueueAppender() {
- }
-
/**
* The <b>QueueConnectionFactoryBindingName</b> option takes a string value.
* Its value will be used to lookup the appropriate
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java
index 43fd790..c88e696 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/JMSTopicAppender.java
@@ -53,9 +53,6 @@ public class JMSTopicAppender extends JMSAppenderBase<ILoggingEvent> {
private PreSerializationTransformer<ILoggingEvent> pst = new LoggingEventPreSerializationTransformer();
- public JMSTopicAppender() {
- }
-
/**
* The <b>TopicConnectionFactoryBindingName</b> option takes a string value.
* Its value will be used to lookup the appropriate
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 4174215..e184610 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
@@ -24,9 +24,6 @@ public class MDCConverter extends ClassicConverter {
String key;
private static final String EMPTY_STRING = "";
- public MDCConverter() {
- }
-
@Override
public void start() {
key = getFirstOption();
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/ContextBasedDiscriminator.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/ContextBasedDiscriminator.java
index 5d428f2..619fb3f 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/ContextBasedDiscriminator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/ContextBasedDiscriminator.java
@@ -34,9 +34,6 @@ public class ContextBasedDiscriminator extends ContextAwareBase implements
private String defaultValue;
private boolean started = false;
- public ContextBasedDiscriminator() {
- }
-
/**
* Return the name of the current context name as found in the logging event.
*/
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/JNDIBasedContextDiscriminator.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/JNDIBasedContextDiscriminator.java
index aaf8cbd..39375ca 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/JNDIBasedContextDiscriminator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/JNDIBasedContextDiscriminator.java
@@ -37,9 +37,6 @@ public class JNDIBasedContextDiscriminator extends ContextAwareBase implements
private String defaultValue;
private boolean started = false;
- public JNDIBasedContextDiscriminator() {
- }
-
/**
* Return the name of the current context name as found in the logging event.
*/
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java b/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java
index 38eb045..7e15f5b 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/sift/MDCBasedDiscriminator.java
@@ -35,9 +35,6 @@ public class MDCBasedDiscriminator extends ContextAwareBase implements
private String defaultValue;
private boolean started = false;
- public MDCBasedDiscriminator() {
- }
-
/**
* Return the value associated with an MDC entry designated by the Key
* property. If that value is null, then return the value assigned to the
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 0e0ed63..f9fff78 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
@@ -50,9 +50,6 @@ public class PackagingDataCalculator {
}
- public PackagingDataCalculator() {
- }
-
public void calculate(IThrowableProxy tp) {
while (tp != null) {
populateFrames(tp.getStackTraceElementProxyArray());
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java
index c41673c..7b752d1 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java
@@ -59,9 +59,6 @@ public final class LogbackMDCAdapter implements MDCAdapter {
// keeps track of the last operation performed
final ThreadLocal<Integer> lastOperation = new ThreadLocal<Integer>();
- public LogbackMDCAdapter() {
- }
-
private Integer getAndSetLastOperation(int op) {
Integer lastOp = lastOperation.get();
lastOperation.set(op);
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java
index 13b4747..f6c4a87 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderH2TestFixture.java
@@ -40,9 +40,6 @@ public class DBAppenderH2TestFixture {
int diff = RandomUtil.getPositiveInt();
- public DBAppenderH2TestFixture() {
- }
-
Connection connection;
public void setUp() throws SQLException {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
index 46853d4..951f1dd 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderHSQLTestFixture.java
@@ -37,9 +37,6 @@ public class DBAppenderHSQLTestFixture {
// boolean isNetwork = true;
HsqlMode mode = HsqlMode.MEM;
- public DBAppenderHSQLTestFixture() {
- }
-
public void setUp() throws SQLException {
switch (mode) {
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 38b3b9b..3ec7234 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
@@ -46,12 +46,6 @@ public class FileAppender<E> extends OutputStreamAppender<E> {
private boolean prudent = false;
/**
- * As in most cases, the default constructor does nothing.
- */
- public FileAppender() {
- }
-
- /**
* The <b>File</b> property takes a string value which should be the name of
* the file to append to.
*/
diff --git a/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java b/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
index ac7924b..8afd2ee 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java
@@ -52,12 +52,6 @@ public class OutputStreamAppender<E> extends UnsynchronizedAppenderBase<E> {
private OutputStream outputStream;
/**
- * The default constructor does nothing.
- */
- public OutputStreamAppender() {
- }
-
- /**
* The underlying output stream used by this appender.
*
* @return
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java
index 0a44086..7e72707 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/EchoEncoder.java
@@ -23,9 +23,6 @@ public class EchoEncoder<E> extends EncoderBase<E> {
String fileHeader;
String fileFooter;
- public EchoEncoder() {
- }
-
public void doEncode(E event) throws IOException {
String val = event + CoreConstants.LINE_SEPARATOR;
outputStream.write(val.getBytes());
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
index 203bef9..9f277b3 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
@@ -35,13 +35,6 @@ public class RollingFileAppender<E> extends FileAppender<E> {
TriggeringPolicy<E> triggeringPolicy;
RollingPolicy rollingPolicy;
- /**
- * The default constructor simply calls its {@link FileAppender#FileAppender
- * parents constructor}.
- */
- public RollingFileAppender() {
- }
-
public void start() {
if (triggeringPolicy == null) {
addWarn("No TriggeringPolicy was set for the RollingFileAppender named "
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DateTokenConverter.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DateTokenConverter.java
index 5e6fa2a..582336d 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DateTokenConverter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/DateTokenConverter.java
@@ -35,9 +35,6 @@ public class DateTokenConverter<E> extends DynamicConverter<E> implements MonoTy
private String datePattern;
private CachingDateFormatter cdf;
- public DateTokenConverter() {
- }
-
public void start() {
this.datePattern = getFirstOption();
if (this.datePattern == null) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/IntegerTokenConverter.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/IntegerTokenConverter.java
index c61a7b7..d914b5d 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/IntegerTokenConverter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/IntegerTokenConverter.java
@@ -25,9 +25,6 @@ public class IntegerTokenConverter extends DynamicConverter implements MonoTyped
public final static String CONVERTER_KEY = "i";
- public IntegerTokenConverter() {
- }
-
public String convert(int i) {
return Integer.toString(i);
}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/BadBeginAction.java b/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/BadBeginAction.java
index 8f17c18..831b836 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/BadBeginAction.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/BadBeginAction.java
@@ -30,9 +30,6 @@ public class BadBeginAction extends Action {
int type;
- public BadBeginAction() {
- }
-
public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException {
String exType = attributes.getValue(EXCEPTION_TYPE);
diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/HelloAction.java b/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/HelloAction.java
index 0d37112..3e81d4b 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/HelloAction.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/HelloAction.java
@@ -25,8 +25,6 @@ public class HelloAction extends Action {
static final public String PROPERTY_KEY = "name";
- public HelloAction() {
- }
/**
* Instantiates an layout of the given class and sets its name.
*
diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/TouchAction.java b/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/TouchAction.java
index 034832e..7a59aca 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/TouchAction.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/action/ext/TouchAction.java
@@ -25,8 +25,6 @@ public class TouchAction extends Action {
public static final String KEY = "touched";
- public TouchAction() {
- }
/**
* Instantiates an layout of the given class and sets its name.
*
diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/Fruit.java b/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/Fruit.java
index 3bdddaa..759a84f 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/Fruit.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/Fruit.java
@@ -22,9 +22,6 @@ public class Fruit {
List<String> textList = new ArrayList<String>();
List<Cake> cakeList = new ArrayList<Cake>();
- public Fruit() {
- }
-
public void setName(String n) {
this.name = n;
}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/ImplicitActionTest.java b/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/ImplicitActionTest.java
index 28f00c5..cab29ef 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/ImplicitActionTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/ImplicitActionTest.java
@@ -36,9 +36,6 @@ public class ImplicitActionTest {
FruitContext fruitContext = new FruitContext();
SimpleConfigurator simpleConfigurator;
- public ImplicitActionTest() {
- }
-
@Before
public void setUp() throws Exception {
fruitContext.setName("fruits");
diff --git a/logback-core/src/test/java/ch/qos/logback/core/joran/replay/Fruit.java b/logback-core/src/test/java/ch/qos/logback/core/joran/replay/Fruit.java
index 6d9d92d..50aab75 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/joran/replay/Fruit.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/joran/replay/Fruit.java
@@ -21,10 +21,6 @@ public class Fruit {
String name;
List<String> textList = new ArrayList<String>();
- public Fruit() {
- // System.out.println("Fruit constructor called");
- }
-
public void setName(String name) {
this.name = name;
}
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 2dd5c51..4e118d3 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
@@ -33,9 +33,6 @@ public class AppenderTrackerTImpl implements AppenderTracker<Object> {
List<TEntry> entryList = new LinkedList<TEntry>();
long lastCheck = 0;
- public AppenderTrackerTImpl() {
- }
-
@SuppressWarnings("unchecked")
synchronized public void put(String k, Appender<Object> appender,
long timestamp) {
diff --git a/logback-core/src/test/java/ch/qos/logback/core/testUtil/StringListAppender.java b/logback-core/src/test/java/ch/qos/logback/core/testUtil/StringListAppender.java
index ad2ff08..a0487fb 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/testUtil/StringListAppender.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/testUtil/StringListAppender.java
@@ -24,10 +24,6 @@ public class StringListAppender<E> extends AppenderBase<E> {
Layout<E> layout;
public List<String> strList = new ArrayList<String>();
- public StringListAppender() {
-
- }
-
public void start() {
strList.clear();
diff --git a/logback-examples/src/main/java/chapters/appenders/CountingConsoleAppender.java b/logback-examples/src/main/java/chapters/appenders/CountingConsoleAppender.java
index a18ec74..1054dbe 100644
--- a/logback-examples/src/main/java/chapters/appenders/CountingConsoleAppender.java
+++ b/logback-examples/src/main/java/chapters/appenders/CountingConsoleAppender.java
@@ -27,9 +27,6 @@ public class CountingConsoleAppender extends AppenderBase<ILoggingEvent> {
PatternLayoutEncoder encoder;
- public CountingConsoleAppender() {
- }
-
public void setLimit(int limit) {
this.limit = limit;
}
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=8cd1a0ef2bcfd92ea2fbdd67…
http://github.com/ceki/logback/commit/8cd1a0ef2bcfd92ea2fbdd678d15323fed614…
commit 8cd1a0ef2bcfd92ea2fbdd678d15323fed614f3a
Author: Tomasz Nurkiewicz <nurkiewicz(a)gmail.com>
Date: Sat Sep 24 09:53:28 2011 +0200
Correct 0.9.30 version in @since tag
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java
index 7a98dfd..09fb525 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/pattern/RootCauseFirstThrowableProxyConverter.java
@@ -20,7 +20,7 @@ import ch.qos.logback.core.CoreConstants;
/**
* @author Tomasz Nurkiewicz
- * @since 2010-08-07, 14:07:10
+ * @since 0.9.30
*/
public class RootCauseFirstThrowableProxyConverter extends ExtendedThrowableProxyConverter {
-----------------------------------------------------------------------
Summary of changes:
.../logback/access/ViewStatusMessagesServlet.java | 3 +-
.../access/boolex/JaninoEventEvaluator.java | 4 ---
.../java/ch/qos/logback/access/db/DBAppender.java | 3 --
.../qos/logback/access/html/DefaultCssBuilder.java | 3 --
.../ch/qos/logback/access/html/UrlCssBuilder.java | 3 --
.../ch/qos/logback/access/net/URLEvaluator.java | 3 --
.../main/java/ch/qos/logback/classic/Level.java | 6 ++--
.../main/java/ch/qos/logback/classic/Logger.java | 24 ++++++++++----------
.../classic/boolex/JaninoEventEvaluator.java | 4 ---
.../java/ch/qos/logback/classic/db/DBAppender.java | 3 --
.../ch/qos/logback/classic/gaffer/GafferUtil.java | 3 +-
.../logback/classic/html/DefaultCssBuilder.java | 3 --
.../classic/html/DefaultThrowableRenderer.java | 3 --
.../ch/qos/logback/classic/html/UrlCssBuilder.java | 3 --
.../java/ch/qos/logback/classic/jmx/MBeanUtil.java | 3 +-
.../logback/classic/joran/JoranConfigurator.java | 3 --
.../qos/logback/classic/net/JMSQueueAppender.java | 3 --
.../qos/logback/classic/net/JMSTopicAppender.java | 3 --
.../qos/logback/classic/pattern/MDCConverter.java | 3 --
.../RootCauseFirstThrowableProxyConverter.java | 5 +--
.../classic/pattern/ThrowableProxyConverter.java | 3 +-
.../classic/sift/ContextBasedDiscriminator.java | 3 --
.../sift/JNDIBasedContextDiscriminator.java | 3 --
.../classic/sift/MDCBasedDiscriminator.java | 3 --
.../classic/spi/PackagingDataCalculator.java | 3 --
.../qos/logback/classic/spi/TurboFilterList.java | 2 +-
.../classic/util/CopyOnInheritThreadLocal.java | 3 +-
.../logback/classic/util/LogbackMDCAdapter.java | 3 --
.../classic/boolex/JaninoEventEvaluatorTest.java | 3 +-
.../ch/qos/logback/classic/corpus/CorpusModel.java | 3 +-
.../qos/logback/classic/db/DBAppenderH2Test.java | 3 +-
.../classic/db/DBAppenderH2TestFixture.java | 3 --
.../qos/logback/classic/db/DBAppenderHSQLTest.java | 7 ++---
.../classic/db/DBAppenderHSQLTestFixture.java | 3 --
.../qos/logback/classic/html/HTMLLayoutTest.java | 3 +-
.../ExtendedThrowableProxyConverterTest.java | 3 +-
.../logback/classic/pattern/MDCConverterTest.java | 3 +-
.../pattern/ThrowableProxyConverterTest.java | 3 +-
.../classic/spi/LoggingEventSerializationTest.java | 3 +-
.../classic/spi/PackagingDataCalculatorTest.java | 3 +-
.../java/ch/qos/logback/core/FileAppender.java | 9 +------
.../ch/qos/logback/core/OutputStreamAppender.java | 6 -----
.../ch/qos/logback/core/encoder/EchoEncoder.java | 3 --
.../ch/qos/logback/core/helpers/NOPAppender.java | 3 +-
.../ch/qos/logback/core/joran/action/Action.java | 13 +++++-----
.../core/joran/spi/ConfigurationWatchList.java | 3 +-
.../logback/core/joran/util/PropertySetter.java | 6 +---
.../logback/core/rolling/RollingFileAppender.java | 7 -----
.../core/rolling/helper/DateTokenConverter.java | 3 --
.../core/rolling/helper/FileFilterUtil.java | 6 +---
.../core/rolling/helper/IntegerTokenConverter.java | 3 --
.../logback/core/spi/CyclicBufferTrackerImpl.java | 3 +-
.../core/FileAppenderResilience_AS_ROOT_Test.java | 3 +-
.../core/joran/action/ext/BadBeginAction.java | 3 --
.../logback/core/joran/action/ext/HelloAction.java | 2 -
.../logback/core/joran/action/ext/TouchAction.java | 2 -
.../logback/core/joran/implicitAction/Fruit.java | 3 --
.../joran/implicitAction/ImplicitActionTest.java | 3 --
.../ch/qos/logback/core/joran/replay/Fruit.java | 4 ---
.../qos/logback/core/joran/spi/CaseCombinator.java | 6 +---
.../core/rolling/MultiThreadedRollingTest.java | 3 +-
.../java/ch/qos/logback/core/sift/Simulator.java | 3 +-
.../core/sift/tracker/AppenderTrackerTImpl.java | 3 --
.../core/spi/CyclicBufferTrackerSimulator.java | 3 +-
.../logback/core/testUtil/StringListAppender.java | 4 ---
.../java/ch/qos/logback/core/util/Compare.java | 3 +-
.../appenders/CountingConsoleAppender.java | 3 --
67 files changed, 56 insertions(+), 208 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-31-g58de50e
by git-noreply@pixie.qos.ch 08 Nov '11
by git-noreply@pixie.qos.ch 08 Nov '11
08 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 58de50e302d443c0d9d0d9a8e2fbcadba14f5391 (commit)
from a2f83e8c0a4779f37c893ac5ad503a3e79f9ae69 (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=58de50e302d443c0d9d0d9a8…
http://github.com/ceki/logback/commit/58de50e302d443c0d9d0d9a8e2fbcadba14f5…
commit 58de50e302d443c0d9d0d9a8e2fbcadba14f5391
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Nov 8 13:41:30 2011 +0100
fix compiler error
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 500a9d3..f20c90b 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
@@ -820,8 +820,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;
- level = Level.locationAwareLoggerIntegerToLevel(levelInt);
+ Level level = Level.fromLocationAwareLoggerInteger(levelInt);
filterAndLog_0_Or3Plus(fqcn, marker, level, message, argArray, t);
}
-----------------------------------------------------------------------
Summary of changes:
.../main/java/ch/qos/logback/classic/Logger.java | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[JIRA] Created: (LBCORE-233) Please offer better support for logging "wrappers"
by Steve Cohen (JIRA) 07 Nov '11
by Steve Cohen (JIRA) 07 Nov '11
07 Nov '11
Please offer better support for logging "wrappers"
--------------------------------------------------
Key: LBCORE-233
URL: http://jira.qos.ch/browse/LBCORE-233
Project: logback-core
Issue Type: New Feature
Reporter: Steve Cohen
Assignee: Logback dev list
Ceki Gulcu asked me to open this issue in response to a thread on the logback user list:
http://mailman.qos.ch/pipermail/logback-user/2011-November/002729.html
A common pattern is to funnel logging requests through a "LogHelper" class
to add some additional functionalities not supported by log4j or
logback.
In earlier log4j days I used such a pattern to allow nicer concatenation of parameters, e.g.
logHelper.debug(Object ... params)
which would concatenate the parameters to build the logging message (using StringBuffer or StringBuilder rather than the "+" operator, which I found much less ugly (and more efficient) than concatenating with plus signs in the main code.
Eventually, slf4j offered something of this sort but by then I had already added to my logHelpers, the ability to use java.lang.String.format() to enable printf style logging messages:
logHelper.debugf(String format, Object ... params)
e.g.
logHelper,.debugf("Major Version: %s, Minor Version %s, majorVersion, minorVersion)
etc.
I preferred mine although what slf4j and logback offer is arguably as good.
Or, in certain situations, the log helper may need to put certain information in the MDC.
There are lots of reasons to use a logHelper. Another advantage they offer, of somewhat debatable value is that only the helper class needs to reference the real logging framework. This made upgrading from log4j to logback a snap, not that it was all that hard otherwise
One area where logback doesn't offer good support for such a pattern is in printing the caller information.
My LogHelper class (sample attached), may nest several calls to produce the final result. I don't want any of these calls to appear in the caller information. The only option logback offered was the caller format converter with the depth parameter, but that meant I had to use a depth of 4 to even see the real logging class, while cluttering the log output with 3 absolutely useless lines of LogHelper references. And restricting to a single depth number would also mean that all calls to the logHelper would require the same number of nested internal calls, also not what I wanted.
It was easy enough to write a converter (actually stealing Ceki Gulcu's CallerDataConverter class) and modifying it to take, instead of a depth parameter, an FQCN of the logHelper class, which enabled the converter to iterate the stack trace and throw out all the logHelper entries and display what I really wanted to see. I had to steal Ceki's code because some of its methods were private and there was no overridable interface or abstract class that let me do what I wanted.
--
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
19

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-30-ga2f83e8
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 a2f83e8c0a4779f37c893ac5ad503a3e79f9ae69 (commit)
from 1cc67039562ac28b9c85e2c9e41269703780f99d (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=a2f83e8c0a4779f37c893ac5…
http://github.com/ceki/logback/commit/a2f83e8c0a4779f37c893ac5ad503a3e79f9a…
commit a2f83e8c0a4779f37c893ac5ad503a3e79f9ae69
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Mon Nov 7 22:20:44 2011 +0100
added a toLocationAwareLoggerInteger method
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 e46393c..acd5750 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
@@ -93,38 +93,6 @@ 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() {
@@ -140,28 +108,28 @@ public final class Level implements java.io.Serializable {
/**
* Convert a Level to an Integer object.
- *
+ *
* @return This level's Integer mapping.
*/
public final Integer toInteger() {
switch (levelInt) {
- case ALL_INT:
- return ALL_INTEGER;
- case TRACE_INT:
- return TRACE_INTEGER;
- case DEBUG_INT:
- return DEBUG_INTEGER;
- case INFO_INT:
- return INFO_INTEGER;
- case WARN_INT:
- return WARN_INTEGER;
- case ERROR_INT:
- return ERROR_INTEGER;
- case OFF_INT:
- return OFF_INTEGER;
- default:
- throw new IllegalStateException("Level " + levelStr + ", " + levelInt
- + " is unknown.");
+ case ALL_INT:
+ return ALL_INTEGER;
+ case TRACE_INT:
+ return TRACE_INTEGER;
+ case DEBUG_INT:
+ return DEBUG_INTEGER;
+ case INFO_INT:
+ return INFO_INTEGER;
+ case WARN_INT:
+ return WARN_INTEGER;
+ case ERROR_INT:
+ return ERROR_INTEGER;
+ case OFF_INT:
+ return OFF_INTEGER;
+ default:
+ throw new IllegalStateException("Level " + levelStr + ", " + levelInt
+ + " is unknown.");
}
}
@@ -184,6 +152,7 @@ public final class Level implements java.io.Serializable {
/**
* This method exists in order to comply with Joran's valueOf convention.
+ *
* @param sArg
* @return
*/
@@ -191,7 +160,7 @@ public final class Level implements java.io.Serializable {
return toLevel(sArg, Level.DEBUG);
}
-
+
/**
* Convert an integer passed as argument to a Level. If the conversion fails,
* then this method returns {@link #DEBUG}.
@@ -206,22 +175,22 @@ public final class Level implements java.io.Serializable {
*/
public static Level toLevel(int val, Level defaultLevel) {
switch (val) {
- case ALL_INT:
- return ALL;
- case TRACE_INT:
- return TRACE;
- case DEBUG_INT:
- return DEBUG;
- case INFO_INT:
- return INFO;
- case WARN_INT:
- return WARN;
- case ERROR_INT:
- return ERROR;
- case OFF_INT:
- return OFF;
- default:
- return defaultLevel;
+ case ALL_INT:
+ return ALL;
+ case TRACE_INT:
+ return TRACE;
+ case DEBUG_INT:
+ return DEBUG;
+ case INFO_INT:
+ return INFO;
+ case WARN_INT:
+ return WARN;
+ case ERROR_INT:
+ return ERROR;
+ case OFF_INT:
+ return OFF;
+ default:
+ return defaultLevel;
}
}
@@ -261,10 +230,69 @@ public final class Level implements java.io.Serializable {
/**
* Return the flyweight instance of the level received through serizalization,
* i.e. 'this'.
- *
+ *
* @return The appropriate flyweight instance
*/
private Object readResolve() {
return toLevel(this.levelInt);
}
+
+ /**
+ * 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 fromLocationAwareLoggerInteger(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;
+ }
+
+ /**
+ * Convert this level instance to an integer value defined in the
+ * {@link LocationAwareLogger} interface.
+ *
+ * @param level The level to convert to LocationAwareLogger integer
+ * @return int An integer corresponding to this level as defined in LocationAwareLogger
+ * @since 1.0.1
+ */
+ public int toLocationAwareLoggerInteger(Level level) {
+ if (level == null)
+ throw new IllegalArgumentException("null level parameter is not admitted");
+ switch (level.toInt()) {
+ case Level.TRACE_INT:
+ return LocationAwareLogger.TRACE_INT;
+ case Level.DEBUG_INT:
+ return LocationAwareLogger.DEBUG_INT;
+ case Level.INFO_INT:
+ return LocationAwareLogger.INFO_INT;
+ case Level.WARN_INT:
+ return LocationAwareLogger.WARN_INT;
+ case Level.ERROR_INT:
+ return LocationAwareLogger.ERROR_INT;
+ default:
+ throw new IllegalArgumentException(level + " not a valid level value");
+ }
+ }
}
-----------------------------------------------------------------------
Summary of changes:
.../main/java/ch/qos/logback/classic/Level.java | 164 ++++++++++++--------
1 files changed, 96 insertions(+), 68 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[JIRA] Created: (LBCLASSIC-305) Logger does not implement LocationAwareLogger correctly with Wrapper class
by Steve Cohen (JIRA) 07 Nov '11
by Steve Cohen (JIRA) 07 Nov '11
07 Nov '11
Logger does not implement LocationAwareLogger correctly with Wrapper class
---------------------------------------------------------------------------
Key: LBCLASSIC-305
URL: http://jira.qos.ch/browse/LBCLASSIC-305
Project: logback-classic
Issue Type: Bug
Affects Versions: 1.0.0
Reporter: Steve Cohen
Assignee: Logback dev list
Attachments: logback-bug.zip
As shown in the attached project, we are logging using Logback classic through a wrapper class (LogHelper), with formatting specified by the %caller format specifier. Instead of showing the desired actual caller of the LogHelper.debug() method, the output shows as the caller, the caller of the caller of the logHelper.
I'm expecting:
2011-11-06 18:49:59,650 DEBUG [main] Caller+0 at org.javactivity.A.<init>(A.java:8)
- Constructor of A
2011-11-06 18:49:59,654 DEBUG [main] Caller+0 at org.javactivity.B.<init>(B.java:7)
- Constructor of B
Instead I get:
2011-11-06 18:49:59,650 DEBUG [main] ?#?:?
- Constructor of A
2011-11-06 18:49:59,654 DEBUG [main] Caller+0 at org.javactivity.A.<init>(A.java:9)
- Constructor of B
--
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