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

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

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

RollingFileAppender.stop介绍

暂无

代码示例

代码示例来源:origin: kaaproject/kaa

@Override
public void close() throws IOException {
 if (rfAppender != null) {
  rfAppender.stop();
 }
}

代码示例来源:origin: com.teradata.airlift/http-server

@Override
public void stop()
    throws Exception
{
  fileAppender.stop();
}

代码示例来源:origin: com.teradata.airlift/log-manager

@Override
public void close()
{
  try {
    fileAppender.stop();
  }
  catch (Exception e) {
    // catch any exception to assure logging always works
    reportError(null, e, CLOSE_FAILURE);
  }
}

代码示例来源:origin: com.github.tornaia/aott-desktop-client-core

@Override
  public void destroy() {
    patternLayoutEncoder.stop();
    fixedWindowRollingPolicy.stop();
    sizeBasedTriggeringPolicy.stop();
    rollingFileAppender.stop();
  }
}

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

@After
public void tearDown() throws Exception {
 rfa.stop();
}

代码示例来源:origin: org.wisdom-framework/wisdom-maven-plugin

(RollingFileAppender<ILoggingEvent>) appender;
String file = new File(basedir, "logs/wisdom.log").getAbsolutePath();
fileAppender.stop();

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

private long logOverMultiplePeriods(ConfigParameters cp) {
  buildRollingFileAppender(cp);
  final int ticksPerPeriod = 216;
  int runLength = cp.simulatedNumberOfPeriods * ticksPerPeriod;
  int startInactivityIndex = cp.startInactivity * ticksPerPeriod;
  int endInactivityIndex = startInactivityIndex + cp.numInactivityPeriods * ticksPerPeriod;
  long tickDuration = cp.periodDurationInMillis / ticksPerPeriod;

  for (int i = 0; i <= runLength; i++) {
   if (i < startInactivityIndex || i > endInactivityIndex) {
    Date currentDate = new Date(tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime());
    StringBuilder sb = new StringBuilder("Hello");
    String currentDateStr = currentDate.toString();
    String iAsString = Integer.toString(i);
    sb.append(currentDateStr);
    SpacePadder.spacePad(sb, 66 + (3 - iAsString.length() - currentDateStr.length()));
    sb.append(iAsString);
    rfa.doAppend(sb.toString());
   }
   tbrp.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime() +
       tickDuration);
   add(tbrp.compressionFuture);
   add(tbrp.cleanUpFuture);
   waitForJobsToComplete();
  }

  rfa.stop();
  return tbrp.timeBasedFileNamingAndTriggeringPolicy.getCurrentTime();
 }
}

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

@Test
public void stopTimeBasedRollingPolicy() {
 rfa.setContext(context);
 tbrp.setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d.log.zip");
 tbrp.start();
 rfa.setRollingPolicy(tbrp);
 rfa.start();
 StatusPrinter.print(context);
 assertTrue(tbrp.isStarted());
 assertTrue(rfa.isStarted());
 rfa.stop();
 assertFalse(rfa.isStarted());
 assertFalse(tbrp.isStarted());
}

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

private void secondPhase(String testId, String file, String stem, String compressionSuffix, int runLength, String prefix) {
 rfa1.stop();
 if (stem != null) {
  File f = new File(file);
  f.setLastModified(currentTime);
 }
 StatusManager sm = context.getStatusManager();
 sm.add(new InfoStatus("Time when rfa1 is stopped: " + new Date(currentTime), this));
 sm.add(new InfoStatus("currentTime%1000=" + (currentTime % 1000), this));
 initRollingFileAppender(rfa2, file);
 initPolicies(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
     + DATE_PATTERN_WITH_SECONDS + ", GMT}-%i.txt" + compressionSuffix, sizeThreshold, currentTime);
 for (int i = runLength; i < runLength * 2; i++) {
  incCurrentTime(100);
  tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
  String msg = prefix + i;
  rfa2.doAppend(msg);
  addExpectedFileNamedIfItsTime(randomOutputDir, testId, msg, compressionSuffix);
 }
}

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

private void doRestart(String testId, String patternPart, boolean fileOptionIsSet, int waitDuration) {
 // change the timestamp of the currently actively file
 File activeFile = new File(rfa1.getFile());
 activeFile.setLastModified(currentTime);
 incCurrentTime(waitDuration);
 String filePatternStr = randomOutputDir + patternPart + "-%d{" + DATE_PATTERN_WITH_SECONDS + ", GMT}";
 String fileName = fileOptionIsSet ? testId2FileName(testId) : null;
 initRFA(rfa2, fileName);
 initTRBP(rfa2, tbrp2, filePatternStr, currentTime);
 for (int i = 0; i < 3; i++) {
  rfa2.doAppend("World---" + i);
  addExpectedFileNamedIfItsTime_ByDate(filePatternStr);
  incCurrentTime(400);
  tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
  add(tbrp2.compressionFuture);
  add(tbrp2.cleanUpFuture);
 }
 rfa2.stop();
}

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

@Test
public void stopFixedWindowRollingPolicy() {
 rfa.setContext(context);
 rfa.setFile(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-.log");
 FixedWindowRollingPolicy fwRollingPolicy = new FixedWindowRollingPolicy();
 fwRollingPolicy.setContext(context);
 fwRollingPolicy.setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%i.log.zip");
 fwRollingPolicy.setParent(rfa);
 fwRollingPolicy.start();
 SizeBasedTriggeringPolicy<Object> sbTriggeringPolicy = new SizeBasedTriggeringPolicy<Object>();
 sbTriggeringPolicy.setContext(context);
 sbTriggeringPolicy.start();
 rfa.setRollingPolicy(fwRollingPolicy);
 rfa.setTriggeringPolicy(sbTriggeringPolicy);
 rfa.start();
 StatusPrinter.print(context);
 assertTrue(fwRollingPolicy.isStarted());
 assertTrue(sbTriggeringPolicy.isStarted());
 assertTrue(rfa.isStarted());
 rfa.stop();
 assertFalse(rfa.isStarted());
 assertFalse(fwRollingPolicy.isStarted());
 assertFalse(sbTriggeringPolicy.isStarted());
}

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

void generic(String testName, String fileName, String filenamePattern, List<String> expectedFilenameList) throws InterruptedException, IOException {
 rfa.setName("ROLLING");
 initRFA(randomOutputDir + fileName);
 sizeBasedTriggeringPolicy.setMaxFileSize(new FileSize(100));
 fwrp.setMinIndex(0);
 fwrp.setFileNamePattern(randomOutputDir + filenamePattern);
 rfa.triggeringPolicy = sizeBasedTriggeringPolicy;
 rfa.rollingPolicy = fwrp;
 fwrp.start();
 sizeBasedTriggeringPolicy.start();
 rfa.start();
 int runLength = 40;
 String prefix = "hello";
 for (int i = 0; i < runLength; i++){
  Thread.sleep(10);
  rfa.doAppend(prefix + i);
 }
 rfa.stop();
 existenceCheck(expectedFilenameList);
 reverseSortedContentCheck(randomOutputDir, runLength, prefix);
}

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

rollingPolicy.start();
appender.stop();
appender.start();

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

private void genericTest(String testId, String patternPrefix, String compressionSuffix, boolean fileOptionIsSet, int waitDuration) throws IOException {
 String fileName = fileOptionIsSet ? testId2FileName(testId) : null;
 initRFA(rfa1, fileName);
 String fileNamePatternStr = randomOutputDir + patternPrefix + "-%d{" + DATE_PATTERN_WITH_SECONDS + ", GMT}" + compressionSuffix;
 initTRBP(rfa1, tbrp1, fileNamePatternStr, currentTime);
 // compute the current filename
 addExpectedFileName_ByDate(fileNamePatternStr, getMillisOfCurrentPeriodsStart());
 incCurrentTime(1100);
 tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
 for (int i = 0; i < 3; i++) {
  rfa1.doAppend("Hello---" + i);
  addExpectedFileNamedIfItsTime_ByDate(fileNamePatternStr);
  incCurrentTime(500);
  tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
  add(tbrp1.compressionFuture);
  add(tbrp1.cleanUpFuture);
 }
 rfa1.stop();
 waitForJobsToComplete();
 if (waitDuration != NO_RESTART) {
  doRestart(testId, patternPrefix, fileOptionIsSet, waitDuration);
 }
 waitForJobsToComplete();
 massageExpectedFilesToCorresponToCurrentTarget(fileName, fileOptionIsSet);
 StatusPrinter.print(context);
 rolloverChecker.check(expectedFilenameList);
}

相关文章