Search in sources :

Example 6 with DummyNanoClock

use of org.apache.logging.log4j.core.util.DummyNanoClock in project logging-log4j2 by apache.

the class PatternParserTest method testNanoPatternShortChangesConfigurationNanoClock.

@Test
public void testNanoPatternShortChangesConfigurationNanoClock() {
    final Configuration config = new NullConfiguration();
    assertTrue(config.getNanoClock() instanceof DummyNanoClock);
    final PatternParser pp = new PatternParser(config, KEY, null);
    assertTrue(config.getNanoClock() instanceof DummyNanoClock);
    pp.parse("%m");
    assertTrue(config.getNanoClock() instanceof DummyNanoClock);
    // this changes the config clock
    pp.parse("%nano");
    assertTrue(config.getNanoClock() instanceof SystemNanoClock);
}
Also used : SystemNanoClock(org.apache.logging.log4j.core.util.SystemNanoClock) NullConfiguration(org.apache.logging.log4j.core.config.NullConfiguration) Configuration(org.apache.logging.log4j.core.config.Configuration) DummyNanoClock(org.apache.logging.log4j.core.util.DummyNanoClock) NullConfiguration(org.apache.logging.log4j.core.config.NullConfiguration) Test(org.junit.Test)

Aggregations

DummyNanoClock (org.apache.logging.log4j.core.util.DummyNanoClock)6 Test (org.junit.Test)6 SystemNanoClock (org.apache.logging.log4j.core.util.SystemNanoClock)4 BufferedReader (java.io.BufferedReader)3 File (java.io.File)3 FileReader (java.io.FileReader)3 Configuration (org.apache.logging.log4j.core.config.Configuration)2 NullConfiguration (org.apache.logging.log4j.core.config.NullConfiguration)2 Logger (org.apache.logging.log4j.Logger)1 ClockFactoryTest (org.apache.logging.log4j.core.util.ClockFactoryTest)1