本文整理了Java中org.apache.logging.log4j.core.Logger.updateConfiguration()
方法的一些代码示例,展示了Logger.updateConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.updateConfiguration()
方法的具体详情如下:
包路径:org.apache.logging.log4j.core.Logger
类名称:Logger
方法名:updateConfiguration
[英]Associates this Logger with a new Configuration. This method is not exposed through the public API.
There are two ways this could be used to guarantee all threads are aware of changes to config.
代码示例来源:origin: mulesoft/mule
/**
* This is workaround for the low visibility of the {@link Logger#updateConfiguration(Configuration)} method, which invokes it
* on the {@code originalLogger}.
*
* Using a wrapper in the log4j package causes an {@link IllegalAccessError}.
*
* @param config
*/
@Override
protected void updateConfiguration(final Configuration config) {
if (lookupUpdateConfigurationMethod()) {
try {
updateConfigurationMethod.invoke(originalLogger, config);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
super.updateConfiguration(config);
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
/**
* Causes all Logger to be updated against the specified Configuration.
*
* @param config The Configuration.
*/
public void updateLoggers(final Configuration config) {
final Configuration old = this.configuration;
for (final Logger logger : loggerRegistry.getLoggers()) {
logger.updateConfiguration(config);
}
firePropertyChangeEvent(new PropertyChangeEvent(this, PROPERTY_CONFIG, old, config));
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
@Override
protected void updateConfiguration(final Configuration newConfig) {
nanoClock = newConfig.getNanoClock();
includeLocation = newConfig.getLoggerConfig(name).isIncludeLocation();
super.updateConfiguration(newConfig);
}
内容来源于网络,如有侵权,请联系作者删除!