本文整理了Java中org.apache.logging.log4j.core.Appender.stop()
方法的一些代码示例,展示了Appender.stop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Appender.stop()
方法的具体详情如下:
包路径:org.apache.logging.log4j.core.Appender
类名称:Appender
方法名:stop
暂无
代码示例来源:origin: apache/incubator-druid
@AfterClass
public static void tearDownStatic()
{
final Logger logger = (Logger) LogManager.getLogger(
LoggingRequestLogger.class);
logger.removeAppender(appender);
appender.stop();
}
代码示例来源:origin: org.apache.logging.log4j/log4j-core
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();
}
}
代码示例来源:origin: org.apache.logging.log4j/log4j-core
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();
}
}
代码示例来源:origin: igniterealtime/Openfire
void removeAppender(final String name) {
final LoggerContext context = LoggerContext.getContext(false);
final Configuration config = context.getConfiguration();
config.getAppenders().remove( name ).stop();
for (final LoggerConfig loggerConfig : config.getLoggers().values()) {
loggerConfig.removeAppender( name );
}
config.getRootLogger().removeAppender( name );
}
代码示例来源:origin: apache/hive
if (appenderControl.get() != null) {
appenderControl.get().stop();
realAppender.get().stop();
代码示例来源:origin: org.apache.logging.log4j/log4j-core
@Test(timeout = 2000)
public void testClose() throws Exception {
final Appender appender = ctx.getRequiredAppender("KafkaAppender");
appender.stop();
}
}
代码示例来源:origin: javamelody/javamelody
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();
}
}
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
/**
* Deletes the specified appender.
*
* @param key The appender's key
*/
public void deleteAppender(final String key) {
LOGGER.debug("Deleting route with " + key + " key ");
final AppenderControl control = appenders.remove(key);
if (null != control) {
LOGGER.debug("Stopping route with " + key + " key");
control.getAppender().stop();
} else {
LOGGER.debug("Route with " + key + " key already deleted");
}
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
/**
* 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();
}
}
代码示例来源:origin: org.infinispan/infinispan-commons-test
/**
* Delete the oldest appenders (sorted by their last access time) until there are maxSize appenders or less.
*/
@Override
public void purge() {
synchronized (this) {
Iterator<String> iterator = appendersUsage.keySet().iterator();
while (appendersUsage.size() > maxSize) {
String key = iterator.next();
LOGGER.debug("Removing appender " + key);
iterator.remove();
routingAppender.getAppenders().get(key).getAppender().stop();
routingAppender.deleteAppender(key);
}
}
}
代码示例来源:origin: elastic/support-diagnostics
public static void cleanup(String dir) {
try {
LoggerContext lc = (LoggerContext) LogManager.getContext(false);
final Configuration config = lc.getConfiguration();
Appender appndr = config.getAppender("File");
appndr.stop();
config.getRootLogger().removeAppender("File");
File tempdir = new File(dir);
tempdir.setWritable(true, false);
FileUtils.deleteDirectory(tempdir);
logger.info("Temp directory {} was deleted.", dir);
} catch (IOException e) {
String msg = "Error deleting temporary work directory";
logger.error(msg, e);
}
logger.info("Cleanup complete.");
}
代码示例来源:origin: org.apache.logging.log4j/log4j-flume-ng
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();
}
}
代码示例来源:origin: org.apache.hive/hive-llap-server
if (appenderControl.get() != null) {
appenderControl.get().stop();
realAppender.get().stop();
代码示例来源:origin: ops4j/org.ops4j.pax.logging
@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;
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
((LifeCycle2) appender).stop(timeout, timeUnit);
} else {
appender.stop();
((LifeCycle2) array[i]).stop(timeout, timeUnit);
} else {
array[i].stop();
代码示例来源:origin: info.magnolia/magnolia-core
/**
* Removes the given appender from the root logger; typically upon tear-down (@After).
*/
public static void stopRecordingLogs(Appender appender) {
LoggerContext context = LoggerContext.getContext(false);
Configuration config = context.getConfiguration();
String appenderName = appender.getName();
if (config.getAppenders().remove(appenderName) != null) {
appender.stop();
config.getRootLogger().removeAppender(appenderName);
context.updateLoggers(config);
}
}
}
代码示例来源:origin: net.bull.javamelody/javamelody-core
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();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!