You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2014/12/02 15:37:49 UTC
logging-log4j2 git commit: Do not hard code thread name in test
fixture because Eclipse can use a different thread name than "main" when
running all the tests in a project at once.
Repository: logging-log4j2
Updated Branches:
refs/heads/master 375d363f2 -> c608e1512
Do not hard code thread name in test fixture because Eclipse can use a
different thread name than "main" when running all the tests in a
project at once.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c608e151
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c608e151
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c608e151
Branch: refs/heads/master
Commit: c608e1512b8a2a29620262565469c07e23c5c760
Parents: 375d363
Author: Gary Gregory <ga...@gmail.com>
Authored: Tue Dec 2 09:37:33 2014 -0500
Committer: Gary Gregory <ga...@gmail.com>
Committed: Tue Dec 2 09:37:33 2014 -0500
----------------------------------------------------------------------
.../org/apache/logging/log4j/core/layout/GelfLayoutTest.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c608e151/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java
index b9d6e07..19a35dc 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/GelfLayoutTest.java
@@ -117,6 +117,7 @@ public class GelfLayoutTest {
final List<LogEvent> events = eventAppender.getEvents();
final List<byte[]> raw = rawAppender.getData();
final List<String> messages = formattedAppender.getMessages();
+ final String threadName = Thread.currentThread().getName();
//@formatter:off
assertJsonEquals("{" +
@@ -124,7 +125,7 @@ public class GelfLayoutTest {
"\"host\": \"" + HOSTNAME + "\"," +
"\"timestamp\": " + GelfLayout.formatTimestamp(events.get(0).getTimeMillis()) + "," +
"\"level\": 7," +
- "\"_thread\": \"main\"," +
+ "\"_thread\": \"" + threadName + "\"," +
"\"_logger\": \"\"," +
"\"short_message\": \"" + LINE1 + "\"," +
"\"_" + KEY1 + "\": \"" + VALUE1 + "\"," +
@@ -137,7 +138,7 @@ public class GelfLayoutTest {
"\"host\": \"" + HOSTNAME + "\"," +
"\"timestamp\": " + GelfLayout.formatTimestamp(events.get(1).getTimeMillis()) + "," +
"\"level\": 6," +
- "\"_thread\": \"main\"," +
+ "\"_thread\": \"" + threadName + "\"," +
"\"_logger\": \"\"," +
"\"short_message\": \"" + LINE2 + "\"," +
"\"_" + KEY1 + "\": \"" + VALUE1 + "\"," +
@@ -172,7 +173,7 @@ public class GelfLayoutTest {
"\"host\": \"" + HOSTNAME + "\"," +
"\"timestamp\": " + GelfLayout.formatTimestamp(events.get(2).getTimeMillis()) + "," +
"\"level\": 3," +
- "\"_thread\": \"main\"," +
+ "\"_thread\": \"" + threadName + "\"," +
"\"_logger\": \"\"," +
"\"short_message\": \"" + LINE3 + "\"," +
"\"full_message\": \"" + String.valueOf(JsonStringEncoder.getInstance().quoteAsString(