You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2018/01/29 15:26:19 UTC

logging-log4j2 git commit: LOG4J2-2225 partial revert to preserve binary compatibility for common use cases (ClockFactory and SystemNanoClock)

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 2b5ec7285 -> 10ba5a139


LOG4J2-2225 partial revert to preserve binary compatibility for common use cases (ClockFactory and SystemNanoClock)


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

Branch: refs/heads/master
Commit: 10ba5a1396cd3221f4063454d1e40c22c86e3317
Parents: 2b5ec72
Author: rpopma <rp...@apache.org>
Authored: Tue Jan 30 00:26:08 2018 +0900
Committer: rpopma <rp...@apache.org>
Committed: Tue Jan 30 00:26:08 2018 +0900

----------------------------------------------------------------------
 .../cassandra/ClockTimestampGenerator.java      |   2 +-
 .../appender/rolling/action/IfLastModified.java |   2 +-
 .../logging/log4j/core/async/AsyncLogger.java   |   2 +-
 .../logging/log4j/core/filter/TimeFilter.java   |   2 +-
 .../logging/log4j/core/impl/Log4jLogEvent.java  |   2 +-
 .../core/impl/ReusableLogEventFactory.java      |   2 +-
 .../log4j/core/pattern/PatternParser.java       |   2 +-
 .../logging/log4j/core/time/ClockFactory.java   | 114 +++++++++++++++++++
 .../log4j/core/time/SystemNanoClock.java        |  36 ++++++
 .../log4j/core/time/internal/ClockFactory.java  | 110 ------------------
 .../core/time/internal/SystemNanoClock.java     |  35 ------
 .../logging/log4j/core/util/ClockFactory.java   |  37 ++++++
 .../log4j/core/util/SystemNanoClock.java        |  35 ++++++
 .../log4j/core/TimestampMessageTest.java        |   4 +-
 .../appender/JsonCompleteFileAppenderTest.java  |   2 +-
 .../core/async/AsyncLoggerTestNanoTime.java     |   2 +-
 .../async/AsyncLoggerTimestampMessageTest.java  |   4 +-
 .../log4j/core/filter/TimeFilterTest.java       |   4 +-
 .../core/impl/Log4jLogEventNanoTimeTest.java    |   2 +-
 .../log4j/core/impl/Log4jLogEventTest.java      |   4 +-
 .../log4j/core/pattern/PatternParserTest.java   |   2 +-
 .../log4j/core/time/ClockFactoryTest.java       | 107 +++++++++++++++++
 .../log4j/core/time/SystemNanoClockTest.java    |  40 +++++++
 .../core/time/internal/ClockFactoryTest.java    | 108 ------------------
 .../core/time/internal/SystemNanoClockTest.java |  41 -------
 25 files changed, 388 insertions(+), 313 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-cassandra/src/main/java/org/apache/logging/log4j/cassandra/ClockTimestampGenerator.java
----------------------------------------------------------------------
diff --git a/log4j-cassandra/src/main/java/org/apache/logging/log4j/cassandra/ClockTimestampGenerator.java b/log4j-cassandra/src/main/java/org/apache/logging/log4j/cassandra/ClockTimestampGenerator.java
index 50d7bc4..be9611d 100644
--- a/log4j-cassandra/src/main/java/org/apache/logging/log4j/cassandra/ClockTimestampGenerator.java
+++ b/log4j-cassandra/src/main/java/org/apache/logging/log4j/cassandra/ClockTimestampGenerator.java
@@ -18,7 +18,7 @@ package org.apache.logging.log4j.cassandra;
 
 import com.datastax.driver.core.TimestampGenerator;
 import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactory;
 
 /**
  * A {@link TimestampGenerator} implementation using the configured {@link Clock}.

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java
index 66902d7..5aba668 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java
@@ -31,7 +31,7 @@ import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactory;
 import org.apache.logging.log4j.status.StatusLogger;
 
 /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
index fd7c6f6..e32f210 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
@@ -31,7 +31,7 @@ import org.apache.logging.log4j.core.config.ReliabilityStrategy;
 import org.apache.logging.log4j.core.impl.ContextDataFactory;
 import org.apache.logging.log4j.core.impl.ContextDataInjectorFactory;
 import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactory;
 import org.apache.logging.log4j.core.util.NanoClock;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.MessageFactory;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/TimeFilter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/TimeFilter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/TimeFilter.java
index 8cab11f..ba7ec99 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/TimeFilter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/TimeFilter.java
@@ -31,7 +31,7 @@ import org.apache.logging.log4j.core.config.plugins.Plugin;
 import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactory;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.util.PerformanceSensitive;
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
index d7da56c..248202c 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/Log4jLogEvent.java
@@ -29,7 +29,7 @@ import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.ThreadContext;
 import org.apache.logging.log4j.core.ContextDataInjector;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactory;
 import org.apache.logging.log4j.core.time.internal.DummyNanoClock;
 import org.apache.logging.log4j.core.util.*;
 import org.apache.logging.log4j.core.time.Instant;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReusableLogEventFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReusableLogEventFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReusableLogEventFactory.java
index 44a2572..2a96007 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReusableLogEventFactory.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ReusableLogEventFactory.java
@@ -26,7 +26,7 @@ import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.async.ThreadNameCachingStrategy;
 import org.apache.logging.log4j.core.config.Property;
 import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactory;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.util.StringMap;
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java
index ac6940a..21747e0 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java
@@ -29,7 +29,7 @@ import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.plugins.util.PluginManager;
 import org.apache.logging.log4j.core.config.plugins.util.PluginType;
-import org.apache.logging.log4j.core.time.internal.SystemNanoClock;
+import org.apache.logging.log4j.core.time.SystemNanoClock;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.util.Strings;
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/time/ClockFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/ClockFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/ClockFactory.java
new file mode 100644
index 0000000..ef6febf
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/ClockFactory.java
@@ -0,0 +1,114 @@
+/*
+ * 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.time;
+
+import org.apache.logging.log4j.core.time.internal.CachedClock;
+import org.apache.logging.log4j.core.time.internal.CoarseCachedClock;
+import org.apache.logging.log4j.core.time.internal.SystemClock;
+import org.apache.logging.log4j.core.time.internal.SystemMillisClock;
+import org.apache.logging.log4j.core.util.Clock;
+import org.apache.logging.log4j.core.util.Loader;
+import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.PropertiesUtil;
+import org.apache.logging.log4j.util.Supplier;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Factory for {@code Clock} objects.
+ * @since 2.11
+ */
+public final class ClockFactory {
+
+    /**
+     * Name of the system property that can be used to specify a {@code Clock}
+     * implementation class. The value of this property is {@value}.
+     */
+    public static final String PROPERTY_NAME = "log4j.Clock";
+    private static final StatusLogger LOGGER = StatusLogger.getLogger();
+
+    // private static final Clock clock = createClock();
+
+    private ClockFactory() {
+    }
+
+    /**
+     * Returns a {@code Clock} instance depending on the value of system
+     * property {@link #PROPERTY_NAME}.
+     * <p>
+     * If system property {@code log4j.Clock=CachedClock} is specified,
+     * this method returns an instance of {@link CachedClock}. If system
+     * property {@code log4j.Clock=CoarseCachedClock} is specified, this
+     * method returns an instance of {@link CoarseCachedClock}.
+     * </p>
+     * <p>
+     * If another value is specified, this value is taken as the fully qualified
+     * class name of a class that implements the {@code Clock} interface. An
+     * object of this class is instantiated and returned.
+     * </p>
+     * <p>
+     * If no value is specified, or if the specified value could not correctly
+     * be instantiated or did not implement the {@code Clock} interface, then an
+     * instance of {@link SystemClock} is returned.
+     * </p>
+     *
+     * @return a {@code Clock} instance
+     */
+    public static Clock getClock() {
+        return createClock();
+    }
+
+    private static Map<String, Supplier<Clock>> aliases() {
+        Map<String, Supplier<Clock>> result = new HashMap<>();
+        result.put("SystemClock",       new Supplier<Clock>() { @Override public Clock get() { return new SystemClock(); } });
+        result.put("SystemMillisClock", new Supplier<Clock>() { @Override public Clock get() { return new SystemMillisClock(); } });
+        result.put("CachedClock",       new Supplier<Clock>() { @Override public Clock get() { return CachedClock.instance(); } });
+        result.put("CoarseCachedClock", new Supplier<Clock>() { @Override public Clock get() { return CoarseCachedClock.instance(); } });
+        result.put("org.apache.logging.log4j.core.time.internal.CachedClock", new Supplier<Clock>() { @Override public Clock get() { return CachedClock.instance(); } });
+        result.put("org.apache.logging.log4j.core.time.internal.CoarseCachedClock", new Supplier<Clock>() { @Override public Clock get() { return CoarseCachedClock.instance(); } });
+        return result;
+    }
+
+    private static Clock createClock() {
+        final String userRequest = PropertiesUtil.getProperties().getStringProperty(PROPERTY_NAME);
+        if (userRequest == null) {
+            LOGGER.trace("Using default SystemClock for timestamps.");
+            return logSupportedPrecision(new SystemClock());
+        }
+        Supplier<Clock> specified = aliases().get(userRequest);
+        if (specified != null) {
+            LOGGER.trace("Using specified {} for timestamps.", userRequest);
+            return logSupportedPrecision(specified.get());
+        }
+        try {
+            final Clock result = Loader.newCheckedInstanceOf(userRequest, Clock.class);
+            LOGGER.trace("Using {} for timestamps.", result.getClass().getName());
+            return logSupportedPrecision(result);
+        } catch (final Exception e) {
+            final String fmt = "Could not create {}: {}, using default SystemClock for timestamps.";
+            LOGGER.error(fmt, userRequest, e);
+            return logSupportedPrecision(new SystemClock());
+        }
+    }
+
+    private static Clock logSupportedPrecision(Clock clock) {
+        String support = clock instanceof PreciseClock ? "supports" : "does not support";
+        LOGGER.debug("{} {} precise timestamps.", clock.getClass().getName(), support);
+        return clock;
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/time/SystemNanoClock.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/SystemNanoClock.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/SystemNanoClock.java
new file mode 100644
index 0000000..13019e5
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/SystemNanoClock.java
@@ -0,0 +1,36 @@
+/*
+ * 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.time;
+
+import org.apache.logging.log4j.core.util.NanoClock;
+
+/**
+ * Implementation of the {@code NanoClock} interface that returns the system nano time.
+ * @since 2.11
+ */
+public final class SystemNanoClock implements NanoClock {
+
+    /**
+     * Returns the system high-resolution time.
+     * @return the result of calling {@code System.nanoTime()}
+     */
+    @Override
+    public long nanoTime() {
+        return System.nanoTime();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/ClockFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/ClockFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/ClockFactory.java
deleted file mode 100644
index 415e903..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/ClockFactory.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.time.internal;
-
-import org.apache.logging.log4j.core.time.PreciseClock;
-import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.util.Loader;
-import org.apache.logging.log4j.status.StatusLogger;
-import org.apache.logging.log4j.util.PropertiesUtil;
-import org.apache.logging.log4j.util.Supplier;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Factory for {@code Clock} objects.
- */
-public final class ClockFactory {
-
-    /**
-     * Name of the system property that can be used to specify a {@code Clock}
-     * implementation class. The value of this property is {@value}.
-     */
-    public static final String PROPERTY_NAME = "log4j.Clock";
-    private static final StatusLogger LOGGER = StatusLogger.getLogger();
-
-    // private static final Clock clock = createClock();
-
-    private ClockFactory() {
-    }
-
-    /**
-     * Returns a {@code Clock} instance depending on the value of system
-     * property {@link #PROPERTY_NAME}.
-     * <p>
-     * If system property {@code log4j.Clock=CachedClock} is specified,
-     * this method returns an instance of {@link CachedClock}. If system
-     * property {@code log4j.Clock=CoarseCachedClock} is specified, this
-     * method returns an instance of {@link CoarseCachedClock}.
-     * </p>
-     * <p>
-     * If another value is specified, this value is taken as the fully qualified
-     * class name of a class that implements the {@code Clock} interface. An
-     * object of this class is instantiated and returned.
-     * </p>
-     * <p>
-     * If no value is specified, or if the specified value could not correctly
-     * be instantiated or did not implement the {@code Clock} interface, then an
-     * instance of {@link SystemClock} is returned.
-     * </p>
-     *
-     * @return a {@code Clock} instance
-     */
-    public static Clock getClock() {
-        return createClock();
-    }
-
-    private static Map<String, Supplier<Clock>> aliases() {
-        Map<String, Supplier<Clock>> result = new HashMap<>();
-        result.put("SystemClock",       new Supplier<Clock>() { @Override public Clock get() { return new SystemClock(); } });
-        result.put("SystemMillisClock", new Supplier<Clock>() { @Override public Clock get() { return new SystemMillisClock(); } });
-        result.put("CachedClock",       new Supplier<Clock>() { @Override public Clock get() { return CachedClock.instance(); } });
-        result.put("CoarseCachedClock", new Supplier<Clock>() { @Override public Clock get() { return CoarseCachedClock.instance(); } });
-        result.put("org.apache.logging.log4j.core.time.internal.CachedClock", new Supplier<Clock>() { @Override public Clock get() { return CachedClock.instance(); } });
-        result.put("org.apache.logging.log4j.core.time.internal.CoarseCachedClock", new Supplier<Clock>() { @Override public Clock get() { return CoarseCachedClock.instance(); } });
-        return result;
-    }
-
-    private static Clock createClock() {
-        final String userRequest = PropertiesUtil.getProperties().getStringProperty(PROPERTY_NAME);
-        if (userRequest == null) {
-            LOGGER.trace("Using default SystemClock for timestamps.");
-            return logSupportedPrecision(new SystemClock());
-        }
-        Supplier<Clock> specified = aliases().get(userRequest);
-        if (specified != null) {
-            LOGGER.trace("Using specified {} for timestamps.", userRequest);
-            return logSupportedPrecision(specified.get());
-        }
-        try {
-            final Clock result = Loader.newCheckedInstanceOf(userRequest, Clock.class);
-            LOGGER.trace("Using {} for timestamps.", result.getClass().getName());
-            return logSupportedPrecision(result);
-        } catch (final Exception e) {
-            final String fmt = "Could not create {}: {}, using default SystemClock for timestamps.";
-            LOGGER.error(fmt, userRequest, e);
-            return logSupportedPrecision(new SystemClock());
-        }
-    }
-
-    private static Clock logSupportedPrecision(Clock clock) {
-        String support = clock instanceof PreciseClock ? "supports" : "does not support";
-        LOGGER.debug("{} {} precise timestamps.", clock.getClass().getName(), support);
-        return clock;
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/SystemNanoClock.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/SystemNanoClock.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/SystemNanoClock.java
deleted file mode 100644
index 1cd1a6f..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/SystemNanoClock.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.time.internal;
-
-import org.apache.logging.log4j.core.util.NanoClock;
-
-/**
- * Implementation of the {@code NanoClock} interface that returns the system nano time.
- */
-public final class SystemNanoClock implements NanoClock {
-
-    /**
-     * Returns the system high-resolution time.
-     * @return the result of calling {@code System.nanoTime()}
-     */
-    @Override
-    public long nanoTime() {
-        return System.nanoTime();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ClockFactory.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ClockFactory.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ClockFactory.java
new file mode 100644
index 0000000..abe26fb
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ClockFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.util;
+
+/**
+ * @deprecated Use {@link org.apache.logging.log4j.core.time.ClockFactory} instead.
+ */
+@Deprecated
+public final class ClockFactory {
+
+    /** @see org.apache.logging.log4j.core.time.ClockFactory#PROPERTY_NAME */
+    @Deprecated
+    public static final String PROPERTY_NAME = org.apache.logging.log4j.core.time.ClockFactory.PROPERTY_NAME;
+
+    private ClockFactory() {}
+
+    /** @see org.apache.logging.log4j.core.time.ClockFactory#getClock() */
+    @Deprecated
+    public static Clock getClock() {
+        return org.apache.logging.log4j.core.time.ClockFactory.getClock();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/main/java/org/apache/logging/log4j/core/util/SystemNanoClock.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/SystemNanoClock.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/SystemNanoClock.java
new file mode 100644
index 0000000..367b2aa
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/SystemNanoClock.java
@@ -0,0 +1,35 @@
+/*
+ * 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.util;
+
+/**
+ * @deprecated Use {@link org.apache.logging.log4j.core.time.SystemNanoClock} instead.
+ */
+@Deprecated
+public final class SystemNanoClock implements NanoClock {
+
+    /**
+     * @see org.apache.logging.log4j.core.time.SystemNanoClock#nanoTime()
+     * @deprecated use {@link org.apache.logging.log4j.core.time.SystemNanoClock} instead.
+     */
+    @Deprecated
+    @Override
+    public long nanoTime() {
+        return System.nanoTime();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/TimestampMessageTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/TimestampMessageTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/TimestampMessageTest.java
index a2c02fb..abea8b0 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/TimestampMessageTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/TimestampMessageTest.java
@@ -20,8 +20,8 @@ import java.util.List;
 
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
-import org.apache.logging.log4j.core.time.internal.ClockFactoryTest;
+import org.apache.logging.log4j.core.time.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactoryTest;
 import org.apache.logging.log4j.core.util.Constants;
 import org.apache.logging.log4j.junit.LoggerContextRule;
 import org.apache.logging.log4j.message.Message;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java
index fcbd40c..853f7e3 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/JsonCompleteFileAppenderTest.java
@@ -26,7 +26,7 @@ import org.apache.logging.log4j.categories.Layouts;
 import org.apache.logging.log4j.core.impl.Log4jLogEventTest;
 import org.apache.logging.log4j.core.selector.ContextSelector;
 import org.apache.logging.log4j.core.selector.CoreContextSelectors;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactory;
 import org.apache.logging.log4j.junit.CleanFiles;
 import org.apache.logging.log4j.junit.LoggerContextRule;
 import org.junit.AfterClass;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTestNanoTime.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTestNanoTime.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTestNanoTime.java
index 628e685..7995f11 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTestNanoTime.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTestNanoTime.java
@@ -27,7 +27,7 @@ import org.apache.logging.log4j.core.CoreLoggerContexts;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.apache.logging.log4j.core.util.Constants;
 import org.apache.logging.log4j.core.time.internal.DummyNanoClock;
-import org.apache.logging.log4j.core.time.internal.SystemNanoClock;
+import org.apache.logging.log4j.core.time.SystemNanoClock;
 import org.apache.logging.log4j.util.Strings;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTimestampMessageTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTimestampMessageTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTimestampMessageTest.java
index 4c9a00f..3551553 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTimestampMessageTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTimestampMessageTest.java
@@ -26,8 +26,8 @@ import org.apache.logging.log4j.categories.AsyncLoggers;
 import org.apache.logging.log4j.core.CoreLoggerContexts;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
-import org.apache.logging.log4j.core.time.internal.ClockFactoryTest;
+import org.apache.logging.log4j.core.time.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactoryTest;
 import org.apache.logging.log4j.core.util.Constants;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.SimpleMessage;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/TimeFilterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/TimeFilterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/TimeFilterTest.java
index 9b026ac..117de29 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/TimeFilterTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/filter/TimeFilterTest.java
@@ -24,8 +24,8 @@ import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.impl.Log4jLogEvent;
 import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
-import org.apache.logging.log4j.core.time.internal.ClockFactoryTest;
+import org.apache.logging.log4j.core.time.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactoryTest;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java
index 5355774..86383b5 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventNanoTimeTest.java
@@ -27,7 +27,7 @@ import org.apache.logging.log4j.core.CoreLoggerContexts;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.apache.logging.log4j.core.util.Constants;
 import org.apache.logging.log4j.core.time.internal.DummyNanoClock;
-import org.apache.logging.log4j.core.time.internal.SystemNanoClock;
+import org.apache.logging.log4j.core.time.SystemNanoClock;
 import org.apache.logging.log4j.util.Strings;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java
index eab4949..1a9a66d 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/Log4jLogEventTest.java
@@ -39,8 +39,8 @@ import org.apache.logging.log4j.ThreadContext.ContextStack;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.plugins.convert.Base64Converter;
 import org.apache.logging.log4j.core.util.Clock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
-import org.apache.logging.log4j.core.time.internal.ClockFactoryTest;
+import org.apache.logging.log4j.core.time.ClockFactory;
+import org.apache.logging.log4j.core.time.ClockFactoryTest;
 import org.apache.logging.log4j.core.time.internal.DummyNanoClock;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.ObjectMessage;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/PatternParserTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/PatternParserTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/PatternParserTest.java
index 5b61b69..7fd7254 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/PatternParserTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/PatternParserTest.java
@@ -34,7 +34,7 @@ import org.apache.logging.log4j.core.impl.ContextDataFactory;
 import org.apache.logging.log4j.core.impl.Log4jLogEvent;
 import org.apache.logging.log4j.core.impl.ThrowableFormatOptions;
 import org.apache.logging.log4j.core.time.internal.DummyNanoClock;
-import org.apache.logging.log4j.core.time.internal.SystemNanoClock;
+import org.apache.logging.log4j.core.time.SystemNanoClock;
 import org.apache.logging.log4j.message.SimpleMessage;
 import org.apache.logging.log4j.util.StringMap;
 import org.apache.logging.log4j.util.Strings;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/time/ClockFactoryTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/time/ClockFactoryTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/time/ClockFactoryTest.java
new file mode 100644
index 0000000..203c70b
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/time/ClockFactoryTest.java
@@ -0,0 +1,107 @@
+/*
+ * 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.time;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.apache.logging.log4j.core.async.AsyncLogger;
+import org.apache.logging.log4j.core.impl.Log4jLogEvent;
+import org.apache.logging.log4j.core.time.internal.CachedClock;
+import org.apache.logging.log4j.core.time.internal.CoarseCachedClock;
+import org.apache.logging.log4j.core.time.internal.SystemClock;
+import org.apache.logging.log4j.core.util.Clock;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+
+import static org.junit.Assert.assertSame;
+
+public class ClockFactoryTest {
+
+    public static void resetClocks() throws IllegalAccessException {
+        resetClock(Log4jLogEvent.class);
+        resetClock(AsyncLogger.class);
+    }
+
+    public static void resetClock(final Class<?> clazz) throws IllegalAccessException {
+        System.clearProperty(ClockFactory.PROPERTY_NAME);
+        final Field field = FieldUtils.getField(clazz, "CLOCK", true);
+        FieldUtils.removeFinalModifier(field, true);
+        FieldUtils.writeStaticField(field, ClockFactory.getClock(), false);
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        resetClocks();
+    }
+
+    @Test
+    public void testDefaultIsSystemClock() {
+        System.clearProperty(ClockFactory.PROPERTY_NAME);
+        assertSame(SystemClock.class, ClockFactory.getClock().getClass());
+    }
+
+    @Test
+    public void testSpecifySystemClockShort() {
+        System.setProperty(ClockFactory.PROPERTY_NAME, "SystemClock");
+        assertSame(SystemClock.class, ClockFactory.getClock().getClass());
+    }
+
+    @Test
+    public void testSpecifySystemClockLong() {
+        System.setProperty(ClockFactory.PROPERTY_NAME, SystemClock.class.getName());
+        assertSame(SystemClock.class, ClockFactory.getClock().getClass());
+    }
+
+    @Test
+    public void testSpecifyCachedClockShort() {
+        System.setProperty(ClockFactory.PROPERTY_NAME, "CachedClock");
+        assertSame(CachedClock.class, ClockFactory.getClock().getClass());
+    }
+
+    @Test
+    public void testSpecifyCachedClockLong() {
+        System.setProperty(ClockFactory.PROPERTY_NAME, CachedClock.class.getName());
+        assertSame(CachedClock.class, ClockFactory.getClock().getClass());
+    }
+
+    @Test
+    public void testSpecifyCoarseCachedClockShort() {
+        System.setProperty(ClockFactory.PROPERTY_NAME, "CoarseCachedClock");
+        assertSame(CoarseCachedClock.class, ClockFactory.getClock().getClass());
+    }
+
+    @Test
+    public void testSpecifyCoarseCachedClockLong() {
+        System.setProperty(ClockFactory.PROPERTY_NAME, CoarseCachedClock.class.getName());
+        assertSame(CoarseCachedClock.class, ClockFactory.getClock().getClass());
+    }
+
+    public static class MyClock implements Clock {
+        @Override
+        public long currentTimeMillis() {
+            return 42;
+        }
+    }
+
+    @Test
+    public void testCustomClock() {
+        System.setProperty(ClockFactory.PROPERTY_NAME, MyClock.class.getName());
+        assertSame(MyClock.class, ClockFactory.getClock().getClass());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/time/SystemNanoClockTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/time/SystemNanoClockTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/time/SystemNanoClockTest.java
new file mode 100644
index 0000000..00b01ee
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/time/SystemNanoClockTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.time;
+
+import org.apache.logging.log4j.core.util.NanoClock;
+import org.junit.Test;
+
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests the SystemNanoClock.
+ */
+public class SystemNanoClockTest {
+
+    @Test
+    public void testReturnsSystemNanoTime() {
+        final NanoClock clock = new SystemNanoClock();
+        final long expected = System.nanoTime();
+        final long actual = clock.nanoTime();
+        assertTrue("smal difference", actual - expected < TimeUnit.SECONDS.toNanos(1));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/time/internal/ClockFactoryTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/time/internal/ClockFactoryTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/time/internal/ClockFactoryTest.java
deleted file mode 100644
index 2db66f2..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/time/internal/ClockFactoryTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.time.internal;
-
-import java.lang.reflect.Field;
-
-import org.apache.commons.lang3.reflect.FieldUtils;
-import org.apache.logging.log4j.core.async.AsyncLogger;
-import org.apache.logging.log4j.core.impl.Log4jLogEvent;
-import org.apache.logging.log4j.core.time.internal.CachedClock;
-import org.apache.logging.log4j.core.time.internal.ClockFactory;
-import org.apache.logging.log4j.core.time.internal.CoarseCachedClock;
-import org.apache.logging.log4j.core.time.internal.SystemClock;
-import org.apache.logging.log4j.core.util.Clock;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class ClockFactoryTest {
-
-    public static void resetClocks() throws IllegalAccessException {
-        resetClock(Log4jLogEvent.class);
-        resetClock(AsyncLogger.class);
-    }
-
-    public static void resetClock(final Class<?> clazz) throws IllegalAccessException {
-        System.clearProperty(ClockFactory.PROPERTY_NAME);
-        final Field field = FieldUtils.getField(clazz, "CLOCK", true);
-        FieldUtils.removeFinalModifier(field, true);
-        FieldUtils.writeStaticField(field, ClockFactory.getClock(), false);
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        resetClocks();
-    }
-
-    @Test
-    public void testDefaultIsSystemClock() {
-        System.clearProperty(ClockFactory.PROPERTY_NAME);
-        assertSame(SystemClock.class, ClockFactory.getClock().getClass());
-    }
-
-    @Test
-    public void testSpecifySystemClockShort() {
-        System.setProperty(ClockFactory.PROPERTY_NAME, "SystemClock");
-        assertSame(SystemClock.class, ClockFactory.getClock().getClass());
-    }
-
-    @Test
-    public void testSpecifySystemClockLong() {
-        System.setProperty(ClockFactory.PROPERTY_NAME, SystemClock.class.getName());
-        assertSame(SystemClock.class, ClockFactory.getClock().getClass());
-    }
-
-    @Test
-    public void testSpecifyCachedClockShort() {
-        System.setProperty(ClockFactory.PROPERTY_NAME, "CachedClock");
-        assertSame(CachedClock.class, ClockFactory.getClock().getClass());
-    }
-
-    @Test
-    public void testSpecifyCachedClockLong() {
-        System.setProperty(ClockFactory.PROPERTY_NAME, CachedClock.class.getName());
-        assertSame(CachedClock.class, ClockFactory.getClock().getClass());
-    }
-
-    @Test
-    public void testSpecifyCoarseCachedClockShort() {
-        System.setProperty(ClockFactory.PROPERTY_NAME, "CoarseCachedClock");
-        assertSame(CoarseCachedClock.class, ClockFactory.getClock().getClass());
-    }
-
-    @Test
-    public void testSpecifyCoarseCachedClockLong() {
-        System.setProperty(ClockFactory.PROPERTY_NAME, CoarseCachedClock.class.getName());
-        assertSame(CoarseCachedClock.class, ClockFactory.getClock().getClass());
-    }
-
-    public static class MyClock implements Clock {
-        @Override
-        public long currentTimeMillis() {
-            return 42;
-        }
-    }
-
-    @Test
-    public void testCustomClock() {
-        System.setProperty(ClockFactory.PROPERTY_NAME, MyClock.class.getName());
-        assertSame(MyClock.class, ClockFactory.getClock().getClass());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/10ba5a13/log4j-core/src/test/java/org/apache/logging/log4j/core/time/internal/SystemNanoClockTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/time/internal/SystemNanoClockTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/time/internal/SystemNanoClockTest.java
deleted file mode 100644
index 7b72952..0000000
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/time/internal/SystemNanoClockTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.time.internal;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.logging.log4j.core.time.internal.SystemNanoClock;
-import org.apache.logging.log4j.core.util.NanoClock;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests the SystemNanoClock.
- */
-public class SystemNanoClockTest {
-
-    @Test
-    public void testReturnsSystemNanoTime() {
-        final NanoClock clock = new SystemNanoClock();
-        final long expected = System.nanoTime();
-        final long actual = clock.nanoTime();
-        assertTrue("smal difference", actual - expected < TimeUnit.SECONDS.toNanos(1));
-    }
-
-}