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

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

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

RollingFileAppender.setImmediateFlush介绍

暂无

代码示例

代码示例来源:origin: jmxtrans/jmxtrans

protected Appender buildAppender(String loggerName, String fileStr) {
  final RollingFileAppender appender = new RollingFileAppender();
  appender.setName(loggerName + "RollingFile");
  appender.setContext(loggerContext);
  appender.setImmediateFlush(true);
  appender.setBufferSize(new FileSize(LOG_IO_BUFFER_SIZE_BYTES));
  appender.setFile(fileStr);
  appender.setEncoder(buildEncoder());
  TriggeringPolicy triggeringPolicy = buildTriggeringPolicy();
  if (triggeringPolicy != null) {
    appender.setTriggeringPolicy(triggeringPolicy);
  }
  appender.setRollingPolicy(buildRollingPolicy(appender, fileStr));
  appender.start();
  return appender;
}

代码示例来源:origin: stackoverflow.com

private Logger logger = null;
private RollingFileAppender appender = null;

private void init(String NameForAppender, String Name4LogFile) {
  logger = Logger.getLogger(NameForAppender); //NOT DEFAULT BY "logger = Logger.getLogger(TestJob.class);"

  appender = new RollingFileAppender();
  appender.setName(NameForAppender); //<-- I think this helps in pair of the Logger.getLogger(NameForAppender) above
  appender.setLayout(new PatternLayout("%d{yyyy-MM-dd/HH:mm:ss.SSS/zzz} %-5p %c{1}:%L - %m%n"));
  appender.setFile(Name4LogFile);
  appender.setAppend(true);
  appender.setImmediateFlush(true);
  appender.setMaxFileSize("100MB");
  appender.setMaxBackupIndex(10);
  appender.activateOptions();

  logger.setAdditivity(false);    //<--do not use default root logger
  logger.addAppender(appender);
}

代码示例来源:origin: org.jmxtrans/jmxtrans-output-logback

protected Appender buildAppender(String loggerName, String fileStr) {
  final RollingFileAppender appender = new RollingFileAppender();
  appender.setName(loggerName + "RollingFile");
  appender.setContext(loggerContext);
  appender.setImmediateFlush(true);
  appender.setBufferSize(new FileSize(LOG_IO_BUFFER_SIZE_BYTES));
  appender.setFile(fileStr);
  appender.setEncoder(buildEncoder());
  TriggeringPolicy triggeringPolicy = buildTriggeringPolicy();
  if (triggeringPolicy != null) {
    appender.setTriggeringPolicy(triggeringPolicy);
  }
  appender.setRollingPolicy(buildRollingPolicy(appender, fileStr));
  appender.start();
  return appender;
}

代码示例来源:origin: com.proofpoint.platform/log

fileAppender = new FlushingFileAppender<>(flushInterval);
fileAppender.setBufferSize(BUFFER_SIZE_IN_BYTES);
fileAppender.setImmediateFlush(false);

相关文章