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 2016/03/01 07:55:49 UTC

logging-log4j2 git commit: [LOG4J2-1299] Add pattern converter for thread id in PatternLayout. Add missing unit test on existing thread name converter.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 5c6819530 -> 848ed0349


[LOG4J2-1299] Add pattern converter for thread id in PatternLayout. Add
missing unit test on existing thread name converter.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/848ed034
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/848ed034
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/848ed034

Branch: refs/heads/master
Commit: 848ed0349ed6d37ee34990f5633cb33b89b0d2c2
Parents: 5c68195
Author: ggregory <gg...@apache.org>
Authored: Mon Feb 29 22:55:47 2016 -0800
Committer: ggregory <gg...@apache.org>
Committed: Mon Feb 29 22:55:47 2016 -0800

----------------------------------------------------------------------
 .../pattern/ThreadNamePatternConverterTest.java | 39 ++++++++++++++++++++
 1 file changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/848ed034/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/ThreadNamePatternConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/ThreadNamePatternConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/ThreadNamePatternConverterTest.java
new file mode 100644
index 0000000..6b5dfc6
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/ThreadNamePatternConverterTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.pattern;
+
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.impl.Log4jLogEvent;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class ThreadNamePatternConverterTest {
+
+    @Test
+    public void testConverterAppendsLogEventNanoTimeToStringBuilder() {
+        final LogEvent event = Log4jLogEvent.newBuilder() //
+                .setThreadName("Hello-1").build();
+        final StringBuilder sb = new StringBuilder();
+        final ThreadPatternConverter converter = ThreadPatternConverter.newInstance(null);
+        converter.format(event, sb);
+        assertEquals("Hello-1", sb.toString());
+    }
+}