Java 类org.apache.logging.log4j.core.config.NullConfiguration 实例源码

项目:QD    文件:Log4j2Logging.java   
private static RollingFileAppender createFileAppender(String name, String logFile, String maxSizeKey,
    Map<String, Exception> errors)
{
    RollingFileAppender.Builder builder = RollingFileAppender.newBuilder();
    builder.setConfiguration(new NullConfiguration());
    builder.withName(name);
    builder.withLayout(getDetailedLayout());
    builder.withFileName(logFile);
    builder.withFilePattern(logFile);
    builder.withAppend(true);
    builder.withImmediateFlush(true);

    int limit = getLimit(maxSizeKey, errors);
    if (limit == 0)
        limit = 900 * 1024 * 1024; // Default in Logging.DEFAULT_MAX_FILE_SIZE
    builder.withPolicy(SizeBasedTriggeringPolicy.createPolicy(Integer.toString(limit)));

    return builder.build();
}
项目:logging-log4j2    文件:GelfLayoutBenchmark.java   
@Setup
public void setUp() {
    System.setProperty("log4j2.enable.direct.encoders", "true");

    appender = new DemoAppender(GelfLayout.newBuilder()
            .setConfiguration(new NullConfiguration())
            .setHost("host")
            .setAdditionalFields(ADDITIONAL_FIELDS)
            .setCompressionType(GelfLayout.CompressionType.OFF)
            .setCompressionThreshold(0)
            .setIncludeStacktrace(true)
            .setIncludeThreadContext(true)
            .build());

    j = 0;
}
项目:logging-log4j2    文件:PatternParserTest.java   
@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);

    pp.parse("%nano"); // this changes the config clock
    assertTrue(config.getNanoClock() instanceof SystemNanoClock);
}
项目:logging-log4j2    文件:PatternParserTest.java   
@Test
public void testNanoPatternLongChangesNanoClockFactoryMode() {
    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);

    pp.parse("%N");
    assertTrue(config.getNanoClock() instanceof SystemNanoClock);
}
项目:logging-log4j2    文件:RequiredValidatorTest.java   
@Test
public void testNullDefaultValue() throws Exception {
    final ValidatingPlugin validatingPlugin = (ValidatingPlugin) new PluginBuilder(plugin)
        .withConfiguration(new NullConfiguration())
        .withConfigurationNode(node)
        .build();
    assertNull(validatingPlugin);
}
项目:logging-log4j2    文件:RequiredValidatorTest.java   
@Test
public void testNonNullValue() throws Exception {
    node.getAttributes().put("name", "foo");
    final ValidatingPlugin validatingPlugin = (ValidatingPlugin) new PluginBuilder(plugin)
        .withConfiguration(new NullConfiguration())
        .withConfigurationNode(node)
        .build();
    assertNotNull(validatingPlugin);
    assertEquals("foo", validatingPlugin.getName());
}
项目:logging-log4j2    文件:ValidatingPluginWithGenericBuilderTest.java   
@Test
public void testNullDefaultValue() throws Exception {
    final ValidatingPluginWithGenericBuilder validatingPlugin = (ValidatingPluginWithGenericBuilder) new PluginBuilder(plugin)
        .withConfiguration(new NullConfiguration())
        .withConfigurationNode(node)
        .build();
    assertNull(validatingPlugin);
}
项目:logging-log4j2    文件:ValidatingPluginWithGenericBuilderTest.java   
@Test
public void testNonNullValue() throws Exception {
    node.getAttributes().put("name", "foo");
    final ValidatingPluginWithGenericBuilder validatingPlugin = (ValidatingPluginWithGenericBuilder) new PluginBuilder(plugin)
        .withConfiguration(new NullConfiguration())
        .withConfigurationNode(node)
        .build();
    assertNotNull(validatingPlugin);
    assertEquals("foo", validatingPlugin.getName());
}
项目:logging-log4j2    文件:ValidatingPluginWithTypedBuilderTest.java   
@Test
public void testNullDefaultValue() throws Exception {
    // @formatter:off
    final ValidatingPluginWithTypedBuilder validatingPlugin = (ValidatingPluginWithTypedBuilder) 
            new PluginBuilder(plugin).
            withConfiguration(new NullConfiguration()).
            withConfigurationNode(node).build();
    // @formatter:on
    assertNull(validatingPlugin);
}
项目:logging-log4j2    文件:ValidatingPluginWithTypedBuilderTest.java   
@Test
public void testNonNullValue() throws Exception {
    node.getAttributes().put("name", "foo");
    // @formatter:off
    final ValidatingPluginWithTypedBuilder validatingPlugin = (ValidatingPluginWithTypedBuilder) 
            new PluginBuilder(plugin).
            withConfiguration(new NullConfiguration()).
            withConfigurationNode(node).build();
    // @formatter:on
    assertNotNull(validatingPlugin);
    assertEquals("foo", validatingPlugin.getName());
}
项目:logging-log4j2    文件:ValidatingPluginWithGenericSubclassFoo1BuilderTest.java   
@Test
public void testNullDefaultValue() throws Exception {
    final PluginWithGenericSubclassFoo1Builder validatingPlugin = (PluginWithGenericSubclassFoo1Builder) new PluginBuilder(plugin)
        .withConfiguration(new NullConfiguration())
        .withConfigurationNode(node)
        .build();
    assertNull(validatingPlugin);
}
项目:logging-log4j2    文件:ValidatingPluginWithGenericSubclassFoo1BuilderTest.java   
@Test
public void testNonNullValue() throws Exception {
    node.getAttributes().put("thing", "thing1");
    node.getAttributes().put("foo1", "foo1");
    final PluginWithGenericSubclassFoo1Builder validatingPlugin = (PluginWithGenericSubclassFoo1Builder) new PluginBuilder(plugin)
        .withConfiguration(new NullConfiguration())
        .withConfigurationNode(node)
        .build();
    assertNotNull(validatingPlugin);
    assertEquals("thing1", validatingPlugin.getThing());
    assertEquals("foo1", validatingPlugin.getFoo1());
}
项目:logging-log4j2    文件:ValidHostValidatorTest.java   
private HostAndPort buildPlugin() {
    return (HostAndPort) new PluginBuilder(plugin)
        .withConfiguration(new NullConfiguration())
        .withConfigurationNode(node)
        .build();
}
项目:logging-log4j2    文件:ValidPortValidatorTest.java   
private HostAndPort buildPlugin() {
    return (HostAndPort) new PluginBuilder(plugin)
        .withConfiguration(new NullConfiguration())
        .withConfigurationNode(node)
        .build();
}
项目:logging-log4j2    文件:CronTriggeringPolicyTest.java   
@Before
public void before() {
    configuration = new NullConfiguration();
}