当前位置: 首页>>代码示例>>Java>>正文


Java Appender.stop方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:19,代码来源:RoutingAppender.java

示例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();
		}
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:16,代码来源:Log4J2Appender.java

示例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();
	}
}
 
开发者ID:sfera-labs,项目名称:sfera,代码行数:20,代码来源:LoggerUtils.java

示例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();
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:9,代码来源:FlumeAppenderTest.java

示例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();
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:17,代码来源:BaseConfiguration.java

示例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();
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:10,代码来源:AbstractSocketServerTest.java

示例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();
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:10,代码来源:JMSQueueTest.java

示例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();
    }
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:9,代码来源:SyslogAppenderTestBase.java

示例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();
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:13,代码来源:SocketAppenderTest.java

示例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();
}
 
开发者ID:neurord,项目名称:stochdiff,代码行数:8,代码来源:CustomFileAppender.java

示例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();
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:18,代码来源:AbstractConfiguration.java

示例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();
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:9,代码来源:SocketAppenderTest.java

示例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();
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:6,代码来源:KafkaAppenderCloseTimeoutTest.java


注:本文中的org.apache.logging.log4j.core.Appender.stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。