"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/test/java/org/apache/logging/log4j/core/async/QueueFullAsyncLoggerConfigLoggingFromToStringTest.java" between
apache-log4j-2.11.1-src.tar.gz and apache-log4j-2.11.2-src.tar.gz

About: Apache Log4j 2 is a logging library for Java. Source distribution (Java).

QueueFullAsyncLoggerConfigLoggingFromToStringTest.java  (apache-log4j-2.11.1-src):QueueFullAsyncLoggerConfigLoggingFromToStringTest.java  (apache-log4j-2.11.2-src)
skipping to change at line 97 skipping to change at line 97
final DomainObject obj = factory.new DomainObject(129); final DomainObject obj = factory.new DomainObject(129);
logger.info("logging naughty object #{} {}", i, obj); logger.info("logging naughty object #{} {}", i, obj);
} }
TRACE("Before stop() blockingAppender.logEvents.count=" + blockingAppend er.logEvents.size()); TRACE("Before stop() blockingAppender.logEvents.count=" + blockingAppend er.logEvents.size());
//CoreLoggerContexts.stopLoggerContext(false); // stop async thread //CoreLoggerContexts.stopLoggerContext(false); // stop async thread
while (blockingAppender.logEvents.size() < 130) { Thread.yield(); } while (blockingAppender.logEvents.size() < 130) { Thread.yield(); }
TRACE("After stop() blockingAppender.logEvents.count=" + blockingAppend er.logEvents.size()); TRACE("After stop() blockingAppender.logEvents.count=" + blockingAppend er.logEvents.size());
final Stack<String> actual = transform(blockingAppender.logEvents); final Stack<String> actual = transform(blockingAppender.logEvents);
assertEquals("Logging in toString() #0", actual.pop()); assertEquals("Logging in toString() #0", actual.pop());
List<StatusData> statusDataList = StatusLogger.getLogger().getStatusData (); final List<StatusData> statusDataList = StatusLogger.getLogger().getStat usData();
assertEquals("Jumped the queue: queue full", assertEquals("Jumped the queue: queue full",
"Logging in toString() #128", actual.pop()); "Logging in toString() #128", actual.pop());
StatusData mostRecentStatusData = statusDataList.get(statusDataList.size () - 1); final StatusData mostRecentStatusData = statusDataList.get(statusDataLis t.size() - 1);
assertEquals("Expected warn level status message", Level.WARN, mostRecen tStatusData.getLevel()); assertEquals("Expected warn level status message", Level.WARN, mostRecen tStatusData.getLevel());
assertThat(mostRecentStatusData.getFormattedStatus(), containsString( assertThat(mostRecentStatusData.getFormattedStatus(), containsString(
"Log4j2 logged an event out of order to prevent deadlock caused by domain " + "Log4j2 logged an event out of order to prevent deadlock caused by domain " +
"objects logging from their toString method when the asy nc queue is full")); "objects logging from their toString method when the asy nc queue is full"));
for (int i = 1; i < 128; i++) { for (int i = 1; i < 128; i++) {
assertEquals("First batch", "Logging in toString() #" + i, actual.po p()); assertEquals("First batch", "Logging in toString() #" + i, actual.po p());
} }
assertEquals("logging naughty object #0 Who's bad?!", actual.pop()); assertEquals("logging naughty object #0 Who's bad?!", actual.pop());
assertTrue(actual.isEmpty()); assertTrue(actual.isEmpty());
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)