本文整理了Java中org.apache.log4j.Appender.doAppend()
方法的一些代码示例,展示了Appender.doAppend()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Appender.doAppend()
方法的具体详情如下:
包路径:org.apache.log4j.Appender
类名称:Appender
方法名:doAppend
[英]Log in Appender
specific way. When appropriate, Loggers will call the doAppend
method of appender implementations in order to log.
[中]以特定方式登录Appender
。适当时,记录者将调用appender实现的doAppend
方法来记录。
代码示例来源:origin: log4j/log4j
/**
Call the <code>doAppend</code> method on all attached appenders. */
public
int appendLoopOnAppenders(LoggingEvent event) {
int size = 0;
Appender appender;
if(appenderList != null) {
size = appenderList.size();
for(int i = 0; i < size; i++) {
appender = (Appender) appenderList.elementAt(i);
appender.doAppend(event);
}
}
return size;
}
代码示例来源:origin: apache/hbase
@Test
public void testAddToFailedServersLogging() {
Throwable nullException = new NullPointerException();
FailedServers fs = new FailedServers(new Configuration());
addr = new InetSocketAddress(TEST_PORT);
fs.addToFailedServers(addr, nullException);
Mockito.verify(mockAppender).doAppend((LoggingEvent) captorLoggingEvent.capture());
LoggingEvent loggingEvent = (LoggingEvent) captorLoggingEvent.getValue();
assertThat(loggingEvent.getLevel(), is(Level.DEBUG));
assertEquals("Added failed server with address " + addr.toString() + " to list caused by "
+ nullException.toString(),
loggingEvent.getRenderedMessage());
}
代码示例来源:origin: apache/hbase
@Test
public void testRegionserverNoRegions() throws Exception {
runRegionserverCanary();
verify(mockAppender).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() {
@Override
public boolean matches(LoggingEvent argument) {
return argument.getRenderedMessage().contains("Regionserver not serving any regions");
}
}));
}
代码示例来源:origin: apache/hbase
@Test
public void testRegionserverWithRegions() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
testingUtility.createTable(tableName, new byte[][] { FAMILY });
runRegionserverCanary();
verify(mockAppender, never()).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() {
@Override
public boolean matches(LoggingEvent argument) {
return argument.getRenderedMessage().contains("Regionserver not serving any regions");
}
}));
}
代码示例来源:origin: apache/hbase
@Test
@Ignore("Intermittent argument matching failures, see HBASE-18813")
public void testWriteTableTimeout() throws Exception {
ExecutorService executor = new ScheduledThreadPoolExecutor(1);
Canary.RegionStdOutSink sink = spy(new Canary.RegionStdOutSink());
Canary canary = new Canary(executor, sink);
String[] args = { "-writeSniffing", "-writeTableTimeout", String.valueOf(Long.MAX_VALUE)};
assertEquals(0, ToolRunner.run(testingUtility.getConfiguration(), canary, args));
assertNotEquals("verify non-null write latency", null, sink.getWriteLatency());
assertNotEquals("verify non-zero write latency", 0L, sink.getWriteLatency());
verify(mockAppender, times(1)).doAppend(argThat(
new ArgumentMatcher<LoggingEvent>() {
@Override
public boolean matches(LoggingEvent argument) {
return argument.getRenderedMessage().contains("The configured write timeout was");
}
}));
}
代码示例来源:origin: apache/hbase
verify(mockAppender, times(1)).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() {
@Override
public boolean matches(LoggingEvent argument) {
verify(mockAppender, times(2)).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() {
@Override
public boolean matches(LoggingEvent argument) {
代码示例来源:origin: camunda/camunda-bpm-platform
/**
Call the <code>doAppend</code> method on all attached appenders. */
public
int appendLoopOnAppenders(LoggingEvent event) {
int size = 0;
Appender appender;
if(appenderList != null) {
size = appenderList.size();
for(int i = 0; i < size; i++) {
appender = (Appender) appenderList.elementAt(i);
appender.doAppend(event);
}
}
return size;
}
代码示例来源:origin: apache/log4j
/**
Call the <code>doAppend</code> method on all attached appenders. */
public
int appendLoopOnAppenders(LoggingEvent event) {
int size = 0;
Appender appender;
if(appenderList != null) {
size = appenderList.size();
for(int i = 0; i < size; i++) {
appender = (Appender) appenderList.elementAt(i);
appender.doAppend(event);
}
}
return size;
}
代码示例来源:origin: org.apache.hbase/hbase-client
@Test
public void testAddToFailedServersLogging() {
Throwable nullException = new NullPointerException();
FailedServers fs = new FailedServers(new Configuration());
addr = new InetSocketAddress(TEST_PORT);
fs.addToFailedServers(addr, nullException);
Mockito.verify(mockAppender).doAppend((LoggingEvent) captorLoggingEvent.capture());
LoggingEvent loggingEvent = (LoggingEvent) captorLoggingEvent.getValue();
assertThat(loggingEvent.getLevel(), is(Level.DEBUG));
assertEquals("Added failed server with address " + addr.toString() + " to list caused by "
+ nullException.toString(),
loggingEvent.getRenderedMessage());
}
代码示例来源:origin: org.ops4j.pax.logging/pax-logging-service
/**
Call the <code>doAppend</code> method on all attached appenders. */
public
int appendLoopOnAppenders(LoggingEvent event) {
int nb = 0;
for (Appender appender : appenderList) {
appender.doAppend(event);
nb++;
}
return nb;
}
代码示例来源:origin: stackoverflow.com
// AppenderAttachableImpl.class
public int appendLoopOnAppenders(LoggingEvent event) {
int size = 0;
if (appenderList != null) {
size = appenderList.size();
for (int i = 0; i < size; i++) {
Appender appender = (Appender) appenderList.elementAt(i);
appender.doAppend(event);
}
}
return size;
}
代码示例来源:origin: org.terracotta/terracotta-l1
public void stopAndSendContentsTo(Appender otherAppender) {
synchronized (this) {
on = false;
}
while (true) {
LoggingEvent event = this.buffer.poll();
if (event == null) break;
otherAppender.doAppend(event);
}
}
代码示例来源:origin: org.terracotta/terracotta-l1-ee
public void stopAndSendContentsTo(Appender otherAppender) {
synchronized (this) {
on = false;
}
while (true) {
LoggingEvent event = this.buffer.poll();
if (event == null) break;
otherAppender.doAppend(event);
}
}
代码示例来源:origin: com.lohika.alp/alp-reporter
/**
* Forwards the event, which is issued by currently running test method, to
* related appender.
*
* @param event the event
*/
public void doAppend(LoggingEvent event) {
Appender a = getCurrentAppender();
if (a != null)
a.doAppend(event);
}
代码示例来源:origin: org.ops4j.pax.logging/pax-logging-service
protected void append(LoggingEvent event)
{
Object value = event.getMDC(key);
String valStr = value == null ? defaultValue : value.toString();
Appender app = getAppender(valStr);
app.doAppend(event);
}
代码示例来源:origin: org.wildfly.core/wildfly-logging
@Override
protected void doPublish(final ExtLogRecord record) {
final Appender appender = this.appender;
if (appender == null) {
throw LoggingLogger.ROOT_LOGGER.handlerClosed();
}
final LoggingEvent event = new LoggingEvent(record, DummyCategory.of(record.getLoggerName()));
appender.doAppend(event);
super.doPublish(record);
}
代码示例来源:origin: wildfly/wildfly-core
@Override
protected void doPublish(final ExtLogRecord record) {
final Appender appender = this.appender;
if (appender == null) {
throw LoggingLogger.ROOT_LOGGER.handlerClosed();
}
final LoggingEvent event = new LoggingEvent(record, DummyCategory.of(record.getLoggerName()));
appender.doAppend(event);
super.doPublish(record);
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testRegionserverNoRegions() throws Exception {
runRegionserverCanary();
verify(mockAppender).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() {
@Override
public boolean matches(LoggingEvent argument) {
return argument.getRenderedMessage().contains("Regionserver not serving any regions");
}
}));
}
代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager
@Override
protected void doPublish(final ExtLogRecord record) {
final LoggingEvent event = new LoggingEvent(record, JBossLogManagerFacade.getLogger(logger));
final List<Appender> appenders = Appenders.getAppenderList(logger);
for (Appender appender : appenders) {
if (new JBossFilterWrapper(appender.getFilter(), true).isLoggable(record)) {
appender.doAppend(event);
}
}
}
代码示例来源:origin: org.apache.hbase/hbase-server
@Test
public void testRegionserverWithRegions() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
testingUtility.createTable(tableName, new byte[][] { FAMILY });
runRegionserverCanary();
verify(mockAppender, never()).doAppend(argThat(new ArgumentMatcher<LoggingEvent>() {
@Override
public boolean matches(LoggingEvent argument) {
return argument.getRenderedMessage().contains("Regionserver not serving any regions");
}
}));
}
内容来源于网络,如有侵权,请联系作者删除!