[logback-dev] svn commit: r1245 - logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net
noreply.seb at qos.ch
noreply.seb at qos.ch
Wed Jan 17 21:44:52 CET 2007
Author: seb
Date: Wed Jan 17 21:44:52 2007
New Revision: 1245
Modified:
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderTest.java
Log:
added a test using a marker
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SocketAppenderTest.java Wed Jan 17 21:44:52 2007
@@ -12,6 +12,10 @@
import java.util.Map;
import junit.framework.TestCase;
+
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
@@ -99,6 +103,25 @@
Map<String, String> MDCPropertyMap = remoteEvent.getMDCPropertyMap();
assertEquals("testValue", MDCPropertyMap.get("key"));
}
+
+ public void testMessageWithMarker() throws InterruptedException {
+ startServer(1);
+ configureClient();
+
+ Logger logger = lc.getLogger(LoggerContext.ROOT_NAME);
+
+ Marker marker = MarkerFactory.getMarker("testMarker");
+ logger.debug(marker, "test msg");
+
+ // Wait max 2 seconds for mock server to finish. However, it should
+ // finish much sooner than that.
+ mockSocketServer.join(2000);
+ assertTrue(mockSocketServer.isFinished());
+ assertEquals(1, mockSocketServer.getEventsList().size());
+
+ LoggingEvent remoteEvent = mockSocketServer.getEventsList().get(0);
+ assertEquals("testMarker", remoteEvent.getMarker().getName());
+ }
public void testMessageWithUpdatedMDC() throws InterruptedException {
startServer(2);
More information about the logback-dev
mailing list