本文整理匯總了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);
}
示例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);
}
示例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));
}
示例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;
}
示例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\\].");
}
示例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;
}