Skip to content

Commit df0e5f9

Browse files
committed
fixed LOGBACK-910
1 parent e5dc2c5 commit df0e5f9

File tree

3 files changed

+43
-5
lines changed

3 files changed

+43
-5
lines changed

logback-core/src/main/java/ch/qos/logback/core/AsyncAppenderBase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ private void put(E eventObject) {
155155
try {
156156
blockingQueue.put(eventObject);
157157
} catch (InterruptedException e) {
158+
// Interruption of current thread when in doAppend method should not be consumed
159+
// by AsyncAppender
160+
Thread.currentThread().interrupt();
158161
}
159162
}
160163

logback-core/src/test/java/ch/qos/logback/core/AsyncAppenderBaseTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,29 @@ public void stopExitsWhenMaxRuntimeReached() throws InterruptedException {
227227
verify(la, loopLen);
228228
}
229229

230+
231+
// Interruption of current thread when in doAppend method should not be consumed
232+
// by async appender. See also http://jira.qos.ch/browse/LOGBACK-910
233+
@Test
234+
public void verifyInterruptionIsNotSwallowed() {
235+
asyncAppenderBase.addAppender(delayingListAppender);
236+
asyncAppenderBase.start();
237+
Thread.currentThread().interrupt();
238+
asyncAppenderBase.doAppend(new Integer(0));
239+
assertTrue(Thread.currentThread().isInterrupted());
240+
// clear flag for next test
241+
Thread.interrupted();
242+
}
243+
244+
@Test
245+
public void verifyInterruptionOfWorkerIsSwallowed() {
246+
asyncAppenderBase.addAppender(delayingListAppender);
247+
asyncAppenderBase.start();
248+
asyncAppenderBase.stop();
249+
assertTrue(asyncAppenderBase.worker.isInterrupted());
250+
}
251+
252+
230253
private void verify(ListAppender<Integer> la, int expectedSize) {
231254
assertFalse(la.isStarted());
232255
assertEquals(expectedSize, la.list.size());

logback-site/src/site/pages/news.html

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,26 @@ <h2>Logback News</h2>
2929

3030
<hr width="80%" align="center" />
3131

32-
<h3>24th of March 2015, Release of version 1.1.3</h3>
33-
3432
<div class="breaking">
35-
<h4>All logback modules now require JDK 1.6 instead of
36-
previously JDK 1.5. This change was put to consultation on the
37-
logback mailing lists with no objections raised.</h4>
33+
<h4>As of version 1.1.3, all logback modules require JDK 1.6
34+
instead of previously JDK 1.5. This change was put to
35+
consultation on the logback mailing lists with no objections
36+
raised.</h4>
3837
</div>
3938

39+
<h3> 2015, Release of version 1.1.4</h3>
40+
41+
<p><code>AsyncAppenderBase</code> now restores the current
42+
thread's inrerupt flag when catching a
43+
<code>InterruptedException</code>. See . The issue, i.e. <a
44+
href="http://jira.qos.ch/browse/LOGBACK-910">LOGBACK-910</a>, was
45+
raised by Henrik Nordvik who also provided the relevant fix.</p>
46+
47+
48+
<hr width="80%" align="center" />
49+
50+
<h3>24th of March 2015, Release of version 1.1.3</h3>
51+
4052
<p>Fixed <code>FileAppender</code>'s prudent mode so that it properly recovers
4153
from IO Errors
4254
(<a href="http://jira.qos.ch/browse/LOGBACK-1046">LOGBACK-1046</a>) </p>

0 commit comments

Comments
 (0)