You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2014/09/04 18:57:11 UTC
[4/5] git commit: Use InitialLoggerContext.getListAppender().
Use InitialLoggerContext.getListAppender().
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c00b7046
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c00b7046
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c00b7046
Branch: refs/heads/master
Commit: c00b70466441c7c8cdb1cdba1afb7dc792bfc1d0
Parents: 60fc53a
Author: Matt Sicker <ma...@apache.org>
Authored: Wed Sep 3 08:49:24 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Thu Sep 4 11:56:49 2014 -0500
----------------------------------------------------------------------
.../java/org/apache/logging/log4j/io/AbstractStreamTest.java | 5 ++---
.../logging/log4j/io/LoggerStreamsCallerInfoTesting.java | 8 ++++----
2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c00b7046/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractStreamTest.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractStreamTest.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractStreamTest.java
index 8c3782e..31fd4b9 100644
--- a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractStreamTest.java
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/AbstractStreamTest.java
@@ -22,7 +22,6 @@ import java.util.List;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.junit.InitialLoggerContext;
import org.apache.logging.log4j.spi.ExtendedLogger;
-import org.apache.logging.log4j.test.appender.ListAppender;
import org.junit.Before;
import org.junit.ClassRule;
@@ -45,7 +44,7 @@ public abstract class AbstractStreamTest {
public static InitialLoggerContext ctx = new InitialLoggerContext("log4j2-streams-unit-test.xml");
protected void assertMessages(final String... messages) {
- final List<String> actualMsgs = ((ListAppender) ctx.getAppender("UnitTest")).getMessages();
+ final List<String> actualMsgs = ctx.getListAppender("UnitTest").getMessages();
assertEquals("Unexpected number of results.", messages.length, actualMsgs.size());
for (int i = 0; i < messages.length; i++) {
final String start = LEVEL.name() + ' ' + messages[i];
@@ -55,6 +54,6 @@ public abstract class AbstractStreamTest {
@Before
public void clearAppender() {
- ((ListAppender) ctx.getAppender("UnitTest")).clear();
+ ctx.getListAppender("UnitTest").clear();
}
}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c00b7046/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerStreamsCallerInfoTesting.java
----------------------------------------------------------------------
diff --git a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerStreamsCallerInfoTesting.java b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerStreamsCallerInfoTesting.java
index 8f050b3..58f6fa0 100644
--- a/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerStreamsCallerInfoTesting.java
+++ b/log4j-iostreams/src/test/java/org/apache/logging/log4j/io/LoggerStreamsCallerInfoTesting.java
@@ -16,8 +16,6 @@
*/
package org.apache.logging.log4j.io;
-import static org.junit.Assert.assertEquals;
-
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.junit.InitialLoggerContext;
@@ -25,6 +23,8 @@ import org.apache.logging.log4j.test.appender.ListAppender;
import org.junit.Before;
import org.junit.ClassRule;
+import static org.junit.Assert.*;
+
public class LoggerStreamsCallerInfoTesting {
protected static Logger getExtendedLogger() {
@@ -41,7 +41,7 @@ public class LoggerStreamsCallerInfoTesting {
public static InitialLoggerContext ctx = new InitialLoggerContext("log4j2-streams-calling-info.xml");
public void assertMessages(final String msg, final int size, final String methodName) {
- final ListAppender appender = (ListAppender) ctx.getAppender("ClassAndMethod");
+ final ListAppender appender = ctx.getListAppender("ClassAndMethod");
assertEquals(msg + ".size", size, appender.getMessages().size());
for (final String message : appender.getMessages()) {
assertEquals(msg + " has incorrect caller info", this.getClass().getName() + '.' + methodName, message);
@@ -50,6 +50,6 @@ public class LoggerStreamsCallerInfoTesting {
@Before
public void clearAppender() {
- ((ListAppender) ctx.getAppender("ClassAndMethod")).clear();
+ ctx.getListAppender("ClassAndMethod").clear();
}
}