org.apache.logging.log4j.core.appender.RollingFileAppender.getManager()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中org.apache.logging.log4j.core.appender.RollingFileAppender.getManager方法的一些代码示例,展示了RollingFileAppender.getManager的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RollingFileAppender.getManager方法的具体详情如下:
包路径:org.apache.logging.log4j.core.appender.RollingFileAppender
类名称:RollingFileAppender
方法名:getManager

RollingFileAppender.getManager介绍

暂无

代码示例

代码示例来源:origin: org.apache.logging.log4j/log4j-core

final TriggeringPolicy policy = app.getManager().getTriggeringPolicy();
assertNotNull("No triggering policy", policy);
assertTrue("Incorrect policy type", policy instanceof CronTriggeringPolicy);

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void testIsCreateOnDemand() {
  final RollingFileAppender rfAppender = loggerContextRule.getRequiredAppender("RollingFile",
      RollingFileAppender.class);
  final RollingFileManager manager = rfAppender.getManager();
  Assert.assertNotNull(manager);
  Assert.assertEquals(createOnDemand, manager.isCreateOnDemand());
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

final TriggeringPolicy policy = app.getManager().getTriggeringPolicy();
assertNotNull("No triggering policy", policy);
assertTrue("Incorrect policy type", policy instanceof CronTriggeringPolicy);

代码示例来源:origin: org.apache.logging.log4j/log4j-core

/**
   * Not a real test, just make sure we can compile access to the typed manager.
   *
   * @throws IOException
   */
  @Test
  public void testAccessManagerWithStrings() throws IOException {
    try (final LoggerContext ctx = LoggerContext.getContext(false)) {
      final Configuration config = ctx.getConfiguration();
      final File file = File.createTempFile("RollingFileAppenderAccessTest", ".tmp");
      file.deleteOnExit();
      final RollingFileAppender appender = RollingFileAppender.createAppender(file.getCanonicalPath(),
          "FilePattern", null, "Name", null, null, null, OnStartupTriggeringPolicy.createPolicy(1), null,
          null, null, null, null, null, config);
      final RollingFileManager manager = appender.getManager();
      // Since the RolloverStrategy and TriggeringPolicy are immutable, we could also use generics to type their
      // access.
      Assert.assertNotNull(manager.getRolloverStrategy());
      Assert.assertNotNull(manager.getTriggeringPolicy());
    }
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

/**
 * Not a real test, just make sure we can compile access to the typed manager.
 *
 * @throws IOException
 */
@Test
public void testAccessManagerWithBuilder() throws IOException {
  try (final LoggerContext ctx = LoggerContext.getContext(false)) {
    final Configuration config = ctx.getConfiguration();
    final File file = File.createTempFile("RollingFileAppenderAccessTest", ".tmp");
    file.deleteOnExit();
    // @formatter:off
    final RollingFileAppender appender = RollingFileAppender.newBuilder()
        .withFileName(file.getCanonicalPath())
        .withFilePattern("FilePattern")
        .withName("Name")
        .withPolicy(OnStartupTriggeringPolicy.createPolicy(1))
        .setConfiguration(config)
        .build();
    // @formatter:on
    final RollingFileManager manager = appender.getManager();
    // Since the RolloverStrategy and TriggeringPolicy are immutable, we could also use generics to type their
    // access.
    Assert.assertNotNull(manager.getRolloverStrategy());
    Assert.assertNotNull(manager.getTriggeringPolicy());
  }
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

/**
 * Returns the triggering policy.
 * @param <T> TriggeringPolicy type
 * @return The TriggeringPolicy
 */
public <T extends TriggeringPolicy> T getTriggeringPolicy() {
  return getManager().getTriggeringPolicy();
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

/**
 * Writes the log entry rolling over the file when required.
 * @param event The LogEvent.
 */
@Override
public void append(final LogEvent event) {
  getManager().checkRollover(event);
  super.append(event);
}

相关文章