當前位置: 首頁>>代碼示例>>Java>>正文


Java Appender.doAppend方法代碼示例

本文整理匯總了Java中ch.qos.logback.core.Appender.doAppend方法的典型用法代碼示例。如果您正苦於以下問題:Java Appender.doAppend方法的具體用法?Java Appender.doAppend怎麽用?Java Appender.doAppend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ch.qos.logback.core.Appender的用法示例。


在下文中一共展示了Appender.doAppend方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: append

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Override
protected void append(E event) {
  if (!isStarted()) {
    return;
  }
  String discriminatingValue = discriminator.getDiscriminatingValue(event);
  long timestamp = getTimestamp(event);

  Appender<E> appender = appenderTracker.getOrCreate(discriminatingValue, timestamp);
  // marks the appender for removal as specified by the user
  if (eventMarksEndOfLife(event)) {
    appenderTracker.endOfLife(discriminatingValue);
  }
  appenderTracker.removeStaleComponents(timestamp);
  appender.doAppend(event);
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:17,代碼來源:SiftingAppenderBase.java

示例2: detachAppenderBoom

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void detachAppenderBoom() throws InterruptedException {
  Appender<Integer> mockAppender = mock(Appender.class);
  when(mockAppender.getName()).thenThrow(new OutOfMemoryError("oops"));
  mockAppender.doAppend(17);

  aai.addAppender(mockAppender);
  Thread t = new Thread(new Runnable() {

    public void run() {
      try {
        // appender.getName called as a result of next statement
        aai.detachAppender("foo");
      } catch (OutOfMemoryError e) {
        // this leaves the write lock locked.
      }
    }
  });
  t.start();
  t.join();

  // the next call used to freeze with the earlier ReadWriteLock lock
  // implementation
  aai.appendLoopOnAppenders(17);
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:27,代碼來源:AppenderAttachableImplLockTest.java

示例3: doTest

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
public void doTest(String configFile) throws JoranException {
  JoranConfigurator configurator = new JoranConfigurator();
  configurator.setContext(context);
  configurator.doConfigure(configFile);

  Appender<IAccessEvent> appender = context.getAppender("DB");
  
  for (int i = 0; i < 10; i++) {
    IAccessEvent event = DummyAccessEventBuilder.buildNewAccessEvent();
    appender.doAppend(event);
  }
  
  StatusPrinter.print(context);
  
  // check that there were no errors
  assertEquals(Status.INFO,  statusChecker.getHighestLevel(0));
  
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:19,代碼來源:DBAppenderIntegrationTest.java

示例4: appendLoopOnAppenders

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
/**
 * Call the <code>doAppend</code> method on all attached appenders.
 */
public int appendLoopOnAppenders(E e) {
  int size = 0;
    for (Appender<E> appender : appenderList) {
      appender.doAppend(e);
      size++;
    }
  return size;
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:12,代碼來源:AppenderAttachableImpl.java

示例5: testNoStart

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Test
public void testNoStart() {
  Appender<E> appender = getAppender();
  appender.setContext(context);
  appender.setName("doh");
  // is null OK?
  appender.doAppend(null);
  StatusChecker checker = new StatusChecker(context.getStatusManager());
  StatusPrinter.print(context);
  checker.assertContainsMatch("Attempted to append to non started appender \\[doh\\].");
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:12,代碼來源:AbstractAppenderTest.java

示例6: appendLoopOnAppenders

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
private int appendLoopOnAppenders(ILoggingEvent event) {
  int size = 0;
  Appender<ILoggingEvent> appender;

  if (appenderList != null) {
    size = appenderList.size();
    for (int i = 0; i < size; i++) {
      appender = appenderList.get(i);
      appender.doAppend(event);
    }
  }
  return size;
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:14,代碼來源:HLogger.java


注:本文中的ch.qos.logback.core.Appender.doAppend方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。