當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。