本文整理汇总了Java中org.apache.logging.log4j.core.Appender.stop方法的典型用法代码示例。如果您正苦于以下问题:Java Appender.stop方法的具体用法?Java Appender.stop怎么用?Java Appender.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.logging.log4j.core.Appender
的用法示例。
在下文中一共展示了Appender.stop方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
@Override
public boolean stop(final long timeout, final TimeUnit timeUnit) {
setStopping();
super.stop(timeout, timeUnit, false);
final Map<String, Appender> map = configuration.getAppenders();
for (final Map.Entry<String, AppenderControl> entry : appenders.entrySet()) {
final Appender appender = entry.getValue().getAppender();
if (!map.containsKey(appender.getName())) {
if (appender instanceof LifeCycle2) {
((LifeCycle2) appender).stop(timeout, timeUnit);
} else {
appender.stop();
}
}
}
setStopped();
return true;
}
示例2: deregister
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
void deregister() {
if (LogManager.getContext(false) instanceof LoggerContext) {
final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
if (ctx.getConfiguration() instanceof AbstractConfiguration) {
final AbstractConfiguration config = (AbstractConfiguration) ctx.getConfiguration();
final Appender appender = getSingleton();
appender.stop();
config.removeAppender(appender.getName());
final Logger rootLogger = LogManager.getRootLogger();
final LoggerConfig loggerConfig = config.getLoggerConfig(rootLogger.getName());
loggerConfig.removeAppender(appender.getName());
ctx.updateLoggers();
}
}
}
示例3: removeRootApender
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
/**
* Removes the specified previously added appender from the root logger.
*
* @param appender
* the appender to remove
*/
public static synchronized void removeRootApender(Appender appender) {
if (addedAppenders > 0) {
Configuration config = getConfiguration();
String name = appender.getName();
LoggerConfig root = config.getRootLogger();
root.removeAppender(name);
appender.stop();
if (--addedAppenders == 0 && originalRootLevel != null) {
root.setLevel(originalRootLevel);
}
getContext().updateLoggers();
}
}
示例4: removeAppenders
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
private void removeAppenders(final Logger logger) {
final Map<String, Appender> map = logger.getAppenders();
for (final Map.Entry<String, Appender> entry : map.entrySet()) {
final Appender app = entry.getValue();
avroLogger.removeAppender(app);
app.stop();
}
}
示例5: removeAppender
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
/**
* Remove an Appender. First removes any associations between LoggerConfigs and the Appender, removes
* the Appender from this appender list and then stops the appender. This method is synchronized in
* case an Appender with the same name is being added during the removal.
* @param name the name of the appender to remove.
*/
public synchronized void removeAppender(final String name) {
for (final LoggerConfig logger : loggers.values()) {
logger.removeAppender(name);
}
final Appender app = appenders.remove(name);
if (app != null) {
app.stop();
}
}
示例6: tearDown
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
@After
public void tearDown() {
final Map<String, Appender> map = root.getAppenders();
for (final Map.Entry<String, Appender> entry : map.entrySet()) {
final Appender app = entry.getValue();
root.removeAppender(app);
app.stop();
}
}
示例7: teardown
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
@After
public void teardown() {
final Map<String,Appender> map = root.getAppenders();
for (final Map.Entry<String, Appender> entry : map.entrySet()) {
final Appender app = entry.getValue();
root.removeAppender(app);
app.stop();
}
}
示例8: removeAppenders
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
protected void removeAppenders() {
final Map<String,Appender> map = root.getAppenders();
for (final Map.Entry<String, Appender> entry : map.entrySet()) {
final Appender app = entry.getValue();
root.removeAppender(app);
app.stop();
}
}
示例9: teardown
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
@After
public void teardown() {
final Map<String,Appender> map = root.getAppenders();
for (final Map.Entry<String, Appender> entry : map.entrySet()) {
final Appender app = entry.getValue();
root.removeAppender(app);
app.stop();
}
tcpCount = 0;
udpCount = 0;
list.clear();
}
示例10: close
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
public static void close() {
if (instance == null)
return;
for (Appender appender: instance.appenders)
appender.stop();
}
示例11: removeAppender
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
/**
* Remove an Appender. First removes any associations between LoggerConfigs and the Appender, removes the Appender
* from this appender list and then stops the appender. This method is synchronized in case an Appender with the
* same name is being added during the removal.
*
* @param appenderName the name of the appender to remove.
*/
public synchronized void removeAppender(final String appenderName) {
for (final LoggerConfig logger : loggerConfigs.values()) {
logger.removeAppender(appenderName);
}
final Appender app = appenders.remove(appenderName);
if (app != null) {
app.stop();
}
}
示例12: removeAndStopAppenders
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
void removeAndStopAppenders() {
final Map<String, Appender> map = logger.getAppenders();
for (final Map.Entry<String, Appender> entry : map.entrySet()) {
final Appender appender = entry.getValue();
logger.removeAppender(appender);
appender.stop();
}
}
示例13: testClose
import org.apache.logging.log4j.core.Appender; //导入方法依赖的package包/类
@Test(timeout = 2000)
public void testClose() throws Exception {
final Appender appender = ctx.getRequiredAppender("KafkaAppender");
appender.stop();
}