You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2016/03/23 15:27:36 UTC

[1/2] logging-log4j2 git commit: Prepare GC free

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 6b8db31c9 -> 0b77d16dc


Prepare GC free


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

Branch: refs/heads/master
Commit: 062367394dcac65a86fe98b507359aab03ea1308
Parents: 6b8db31
Author: Mikael Ståldal <mi...@magine.com>
Authored: Wed Mar 23 15:26:15 2016 +0100
Committer: Mikael Ståldal <mi...@magine.com>
Committed: Wed Mar 23 15:26:15 2016 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/logging/log4j/core/layout/GelfLayout.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06236739/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
index cb471a3..6d247c2 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
@@ -221,7 +221,7 @@ public final class GelfLayout extends AbstractStringLayout {
     /**
      * Non-private to make it accessible from unit test.
      */
-    static String formatTimestamp(final long timeMillis) {
+    static CharSequence formatTimestamp(final long timeMillis) {
         return new BigDecimal(timeMillis).divide(TIME_DIVISOR).toPlainString();
     }
 


[2/2] logging-log4j2 git commit: Unit test for formatTimestamp

Posted by mi...@apache.org.
Unit test for formatTimestamp


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

Branch: refs/heads/master
Commit: 0b77d16dc17cf435243b7f4bb9abc7e7e3ea0ec1
Parents: 0623673
Author: Mikael Ståldal <mi...@magine.com>
Authored: Wed Mar 23 15:27:09 2016 +0100
Committer: Mikael Ståldal <mi...@magine.com>
Committed: Wed Mar 23 15:27:09 2016 +0100

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/layout/GelfLayoutTest.java | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0b77d16d/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 c82fa21..c89fad9 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
@@ -38,6 +38,7 @@ import java.util.zip.GZIPInputStream;
 import java.util.zip.InflaterInputStream;
 
 import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals;
+import static org.junit.Assert.assertEquals;
 
 public class GelfLayoutTest {
     static ConfigurationFactory configFactory = new BasicConfigurationFactory();
@@ -209,4 +210,11 @@ public class GelfLayoutTest {
     public void testLayoutZlibCompression() throws Exception {
         testCompressedLayout(CompressionType.ZLIB);
     }
+
+    @Test
+    public void testFormatTimestamp() {
+        assertEquals("0", GelfLayout.formatTimestamp(0L).toString());
+        assertEquals("1458741206.653", GelfLayout.formatTimestamp(1458741206653L).toString());
+        assertEquals("9223372036854775.807", GelfLayout.formatTimestamp(Long.MAX_VALUE).toString());
+    }
 }