ch.qos.logback.core.rolling.RollingFileAppender.setPrudent()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(137)

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

RollingFileAppender.setPrudent介绍

暂无

代码示例

代码示例来源:origin: cn.jiangzeyin/common-boot

appender.setEncoder(encoder);
appender.setPrudent(true);
appender.start();
asyncAppender.addAppender(appender);

代码示例来源:origin: tony19/logback-android

@Test
public void testPrudentModeLogicalImplicationsOnCompression() {
 rfa.setContext(context);
 rfa.setAppend(false);
 rfa.setPrudent(true);
 tbrp.setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d.log.zip");
 tbrp.start();
 rfa.setRollingPolicy(tbrp);
 rfa.start();
 StatusChecker checker = new StatusChecker(context);
 assertFalse(rfa.isStarted());
 assertEquals(Status.ERROR, checker.getHighestLevel(0));
}

代码示例来源:origin: tony19/logback-android

@Test
public void testPrudentModeLogicalImplications() {
 rfa.setContext(context);
 // prudent mode will force "file" property to be null
 rfa.setFile("some non null value");
 rfa.setAppend(false);
 rfa.setPrudent(true);
 tbrp
     .setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d.log");
 tbrp.start();
 rfa.setRollingPolicy(tbrp);
 rfa.start();
 assertTrue(rfa.isAppend());
 assertNull(rfa.rawFileProperty());
 assertTrue(rfa.isStarted());
}

代码示例来源:origin: tony19/logback-android

@Test
public void collidingTimeformat() {
 rfa.setContext(context);
 rfa.setAppend(false);
 rfa.setPrudent(true);
 tbrp.setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d{dd}.log.zip");
 tbrp.start();
 rfa.setRollingPolicy(tbrp);
 rfa.start();
 StatusChecker checker = new StatusChecker(context);
 assertFalse(rfa.isStarted());
 assertEquals(Status.ERROR, checker.getHighestLevel(0));
 StatusPrinter.print(context);
 checker.assertContainsMatch("The date format in FileNamePattern will result");
}

代码示例来源:origin: tony19/logback-android

@SuppressWarnings("unchecked")
static LoggerContext buildLoggerContext(String stamp, String filename,
  boolean safetyMode) {
 LoggerContext loggerContext = new LoggerContext();
 RollingFileAppender<ILoggingEvent> rfa = new RollingFileAppender<ILoggingEvent>();
 PatternLayoutEncoder patternLayout = new PatternLayoutEncoder();
 patternLayout.setPattern(stamp + " %5p - %-50m%n");
 patternLayout.setContext(loggerContext);
 patternLayout.start();
 rfa.setEncoder(patternLayout);
 
 rfa.setAppend(true);
 rfa.setPrudent(safetyMode);
 rfa.setContext(loggerContext);
 TimeBasedRollingPolicy<ILoggingEvent> tbrp = new TimeBasedRollingPolicy();
 
 tbrp.setContext(loggerContext);
 tbrp.setFileNamePattern(filename+"-%d{"+DATE_PATTERN+"}.log");
 tbrp.setParent(rfa);
 tbrp.start();

 rfa.setRollingPolicy(tbrp);
 
 rfa.start();
 ch.qos.logback.classic.Logger root = loggerContext
   .getLogger(Logger.ROOT_LOGGER_NAME);
 root.addAppender(rfa);
 return loggerContext;
}

代码示例来源:origin: com.plausiblelabs.warwizard/warwizard-core

appender.setLayout(formatter);
appender.setFile(file.getCurrentLogFilename());
appender.setPrudent(false);
appender.setRollingPolicy(rollingPolicy);
appender.setTriggeringPolicy(triggeringPolicy);

相关文章