本文整理了Java中org.apache.logging.log4j.core.Logger.setAdditive()
方法的一些代码示例,展示了Logger.setAdditive()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.setAdditive()
方法的具体详情如下:
包路径:org.apache.logging.log4j.core.Logger
类名称:Logger
方法名:setAdditive
[英]This method is not exposed through the public API and is present only to support the Log4j 1.2 compatibility bridge.
[中]此方法不通过公共API公开,仅用于支持Log4j 1.2兼容桥。
代码示例来源:origin: alibaba/nacos
@Override
public void setAdditivity(boolean additivity) {
logger.setAdditive(additivity);
}
代码示例来源:origin: org.apache.logging.log4j/log4j-core
protected void initRootLogger(final Appender appender) {
root.addAppender(appender);
root.setAdditive(false);
root.setLevel(Level.DEBUG);
}
代码示例来源:origin: org.apache.logging.log4j/log4j-core
final Logger root = context.getLogger("SMTPAppenderTest");
root.addAppender(appender);
root.setAdditive(false);
root.setLevel(Level.DEBUG);
代码示例来源:origin: mulesoft/mule
@Override
public void setAdditive(boolean additive) {
getLogger().setAdditive(additive);
}
代码示例来源:origin: org.apache.logging.log4j/log4j-core
@Test
public void testUdpAppender() throws Exception {
try {
udpServer.latch.await();
} catch (final InterruptedException ex) {
ex.printStackTrace();
}
// @formatter:off
final SocketAppender appender = SocketAppender.newBuilder()
.withProtocol(Protocol.UDP)
.withPort(tcpServer.getLocalPort())
.withReconnectDelayMillis(-1)
.withName("test")
.withImmediateFail(false)
.withLayout(JsonLayout.newBuilder().setProperties(true).build())
.build();
// @formatter:on
appender.start();
// set appender on root and set level to debug
logger.addAppender(appender);
logger.setAdditive(false);
logger.setLevel(Level.DEBUG);
logger.debug("This is a udp message");
final LogEvent event = udpServer.getQueue().poll(3, TimeUnit.SECONDS);
assertNotNull("No event retrieved", event);
assertTrue("Incorrect event", event.getMessage().getFormattedMessage().equals("This is a udp message"));
assertTrue("Message not delivered via UDP", udpServer.getCount() > 0);
}
代码示例来源:origin: org.apache.logging.log4j/log4j-core
logger.setAdditive(false);
logger.setLevel(Level.DEBUG);
final String tcKey = "UUID";
代码示例来源:origin: org.apache.logging.log4j/log4j-core
@Test
public void testTcpAppenderDeadlock() throws Exception {
// @formatter:off
final SocketAppender appender = SocketAppender.newBuilder()
.withHost("localhost")
.withPort(DYN_PORT)
.withReconnectDelayMillis(100)
.withName("test")
.withImmediateFail(false)
.withLayout(JsonLayout.newBuilder().setProperties(true).build())
.build();
// @formatter:on
appender.start();
// set appender on root and set level to debug
logger.addAppender(appender);
logger.setAdditive(false);
logger.setLevel(Level.DEBUG);
final TcpSocketTestServer tcpSocketServer = new TcpSocketTestServer(DYN_PORT);
try {
tcpSocketServer.start();
logger.debug("This message is written because a deadlock never.");
final LogEvent event = tcpSocketServer.getQueue().poll(3, TimeUnit.SECONDS);
assertNotNull("No event retrieved", event);
} finally {
tcpSocketServer.shutdown();
}
}
代码示例来源:origin: org.apache.logging.log4j/log4j-core
@Test
public void testTcpAppenderNoWait() throws Exception {
// @formatter:off
final SocketAppender appender = SocketAppender.newBuilder()
.withHost("localhost")
.withPort(ERROR_PORT)
.withReconnectDelayMillis(100)
.withName("test")
.withImmediateFail(false)
.withIgnoreExceptions(false)
.withLayout(JsonLayout.newBuilder().setProperties(true).build())
.build();
// @formatter:on
appender.start();
// set appender on root and set level to debug
logger.addAppender(appender);
logger.setAdditive(false);
logger.setLevel(Level.DEBUG);
try {
logger.debug("This message is written because a deadlock never.");
fail("No Exception was thrown");
} catch (final Exception ex) {
// TODO: move exception to @Test(expect = Exception.class)
// Failure is expected.
// ex.printStackTrace();
}
}
代码示例来源:origin: org.apache.logging.log4j/log4j-1.2-api
public void setAdditivity(final boolean additivity) {
logger.setAdditive(additivity);
}
代码示例来源:origin: com.alibaba.edas.acm/acm-sdk
@Override
public void setAdditivity(boolean additivity) {
logger.setAdditive(additivity);
}
代码示例来源:origin: com.alibaba.nacos/nacos-client
@Override
public void setAdditivity(boolean additivity) {
logger.setAdditive(additivity);
}
代码示例来源:origin: com.taobao.middleware/logger.core
@Override
public void setAdditivity(boolean additivity) {
logger.setAdditive(additivity);
}
代码示例来源:origin: org.apache.logging.log4j.adapters/log4j-1.2-api
public void setAdditivity(final boolean additivity) {
logger.setAdditive(additivity);
}
代码示例来源:origin: org.apache.logging.log4j/log4j12-api
public void setAdditivity(boolean additivity) {
logger.setAdditive(additivity);
}
代码示例来源:origin: org.mule.modules/mule-module-launcher
@Override
public void setAdditive(boolean additive)
{
getLogger().setAdditive(additive);
}
代码示例来源:origin: org.mule.runtime/mule-module-launcher
@Override
public void setAdditive(boolean additive) {
getLogger().setAdditive(additive);
}
代码示例来源:origin: alipay/sofa-common-tools
private void resetLog(Logger logger) {
logger.getAppenders().clear();
logger.addAppender(consoleAppender);
logger.setLevel(getConsoleLevel(spaceId.getSpaceName(), properties));
logger.setAdditive(false);
}
});
内容来源于网络,如有侵权,请联系作者删除!