本文整理了Java中org.apache.log4j.LogManager.resetConfiguration()
方法的一些代码示例,展示了LogManager.resetConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LogManager.resetConfiguration()
方法的具体详情如下:
包路径:org.apache.log4j.LogManager
类名称:LogManager
方法名:resetConfiguration
[英]No-op implementation.
[中]没有op实现。
代码示例来源:origin: log4j/log4j
/**
Reset the default hierarchy to its defaut. It is equivalent to
calling
<code>Category.getDefaultHierarchy().resetConfiguration()</code>.
See {@link Hierarchy#resetConfiguration()} for more details. */
public
static
void resetConfiguration() {
LogManager.resetConfiguration();
}
}
代码示例来源:origin: alibaba/jstorm
public static void updateLog4jConfiguration(Class<?> targetClass,
String log4jPath) throws Exception {
Properties customProperties = new Properties();
FileInputStream fs = null;
InputStream is = null;
try {
fs = new FileInputStream(log4jPath);
is = targetClass.getResourceAsStream("/log4j.properties");
customProperties.load(fs);
Properties originalProperties = new Properties();
originalProperties.load(is);
for (Entry<Object, Object> entry : customProperties.entrySet()) {
originalProperties.setProperty(entry.getKey().toString(), entry
.getValue().toString());
}
LogManager.resetConfiguration();
PropertyConfigurator.configure(originalProperties);
}finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(fs);
}
}
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Update the log4j configuration.
*
* @param targetClass the target class used to get the original log4j configuration file as a resource
* @param log4jFileName the custom log4j configuration properties file name
* @throws IOException if there's something wrong with updating the log4j configuration
*/
public static void updateLog4jConfiguration(Class<?> targetClass, String log4jFileName)
throws IOException {
final Closer closer = Closer.create();
try {
final InputStream inputStream = closer.register(targetClass.getResourceAsStream("/" + log4jFileName));
final Properties originalProperties = new Properties();
originalProperties.load(inputStream);
LogManager.resetConfiguration();
PropertyConfigurator.configure(originalProperties);
} catch (Throwable t) {
throw closer.rethrow(t);
} finally {
closer.close();
}
}
}
代码示例来源:origin: apache/incubator-gobblin
LogManager.resetConfiguration();
PropertyConfigurator.configure(originalProperties);
} catch (Throwable t) {
代码示例来源:origin: geoserver/geoserver
@Before
public void cleanupLoggers() {
LogManager.resetConfiguration();
}
代码示例来源:origin: geoserver/geoserver
LogManager.resetConfiguration();
代码示例来源:origin: pentaho/pentaho-kettle
private void applyLog4jConfiguration() {
LogLog.setQuietMode( true );
LogManager.resetConfiguration();
LogLog.setQuietMode( false );
/**
* On DOMConfigurator.doConfigure() no exception is ever propagated; it's caught and its stacktrace is written to System.err.
*
* @link https://github.com/apache/log4j/blob/v1_2_17_rc3/src/main/java/org/apache/log4j/xml/DOMConfigurator.java#L877-L878
*
* When the kettle5-log4j-plugin is dropped under ~/.kettle/plugins ( which is also a valid location for classic pdi plugins )
* we get a System.err 'FileNotFoundException' stacktrace, as this is attempting to fetch the log4j.xml under a (default path) of
* data-integration/plugins/kettle5-log4j-plugin; but in this scenario ( again, a valid one ), kettle5-log4j-plugin is under ~/.kettle/plugins
*
* With the inability to catch any exception ( as none is ever propagated ), the option left is to infer the starting path of this plugin's jar;
* - If it starts with Const.getKettleDirectory(): then we know it to have been dropped in ~/.kettle/plugins ( a.k.a. Const.getKettleDirectory() )
* - Otherwise: fallback to default/standard location, which is under <pdi-install-dir>/</>data-integration/plugins
*/
final String log4jPath = getPluginPath().startsWith( getKettleDirPath() )
? ( Const.getKettleDirectory() + File.separator + PLUGIN_PROPERTIES_FILE ) : getConfigurationFileName();
DOMConfigurator.configure( log4jPath );
}
代码示例来源:origin: apache/log4j
/**
Reset the default hierarchy to its defaut. It is equivalent to
calling
<code>Category.getDefaultHierarchy().resetConfiguration()</code>.
See {@link Hierarchy#resetConfiguration()} for more details. */
public
static
void resetConfiguration() {
LogManager.resetConfiguration();
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
Reset the default hierarchy to its defaut. It is equivalent to
calling
<code>Category.getDefaultHierarchy().resetConfiguration()</code>.
See {@link Hierarchy#resetConfiguration()} for more details. */
public
static
void resetConfiguration() {
LogManager.resetConfiguration();
}
}
代码示例来源:origin: apache/metron
public static void updateLog4jConfiguration(Class<?> targetClass,
String log4jPath) throws Exception {
Properties customProperties = new Properties();
FileInputStream fs = null;
InputStream is = null;
try {
fs = new FileInputStream(log4jPath);
is = targetClass.getResourceAsStream("/log4j.properties");
customProperties.load(fs);
Properties originalProperties = new Properties();
originalProperties.load(is);
for (Entry<Object, Object> entry : customProperties.entrySet()) {
originalProperties.setProperty(entry.getKey().toString(), entry
.getValue().toString());
}
LogManager.resetConfiguration();
PropertyConfigurator.configure(originalProperties);
}finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(fs);
}
}
}
代码示例来源:origin: p6spy/p6spy
@Before
public void setup() throws Exception {
// reset log4j
LogManager.resetConfiguration();
// initialize framework
framework = new P6TestFramework("log4j") {
};
framework.setUpFramework();
}
代码示例来源:origin: p6spy/p6spy
protected void configure(String log4jConfSuffix, boolean removeDefaultExcludedCategories) throws Exception {
if (removeDefaultExcludedCategories) {
// we test slf4j filtering here rather than categories one
P6LogOptions.getActiveInstance().setExcludecategories("");
}
// reset log4j
LogManager.resetConfiguration();
// configure log4j externally
configureLog4JInTest(log4jConfSuffix);
}
代码示例来源:origin: p6spy/p6spy
@After
public void cleanup() throws Exception {
// restore default excluded categories
P6LogOptions.getActiveInstance().setExcludecategories(
StringUtils.join(P6TestOptionDefaults.DEFAULT_CATEGORIES, ","));
framework.closeConnection();
// reset log4j
LogManager.resetConfiguration();
// load default configuration
configureLog4J();
}
代码示例来源:origin: org.ops4j.pax.logging/pax-logging-service
/**
* Shut down the Pax Logging service. This will reset the logging configuration entirely, so it should only be
* used just before disposing of the service instance.
*/
protected void shutdown() {
LogManager.resetConfiguration();
}
代码示例来源:origin: apache-log4j/log4j
/**
Reset the default hierarchy to its defaut. It is equivalent to
calling
<code>Category.getDefaultHierarchy().resetConfiguration()</code>.
See {@link Hierarchy#resetConfiguration()} for more details. */
public
static
void resetConfiguration() {
LogManager.resetConfiguration();
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
/**
Reset the default hierarchy to its defaut. It is equivalent to
calling
<code>Category.getDefaultHierarchy().resetConfiguration()</code>.
See {@link Hierarchy#resetConfiguration()} for more details. */
public
static
void resetConfiguration() {
LogManager.resetConfiguration();
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
Reset the default hierarchy to its defaut. It is equivalent to
calling
<code>Category.getDefaultHierarchy().resetConfiguration()</code>.
See {@link Hierarchy#resetConfiguration()} for more details. */
public
static
void resetConfiguration() {
LogManager.resetConfiguration();
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
private void resetLogger() {
// Force a reset on the logger's configuration
LogManager.resetConfiguration();
new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
}
代码示例来源:origin: apache/oozie
@Override
protected void setUp() throws Exception {
super.setUp();
LogFactory.getFactory().release();
LogManager.resetConfiguration();
}
代码示例来源:origin: apache/oozie
@Override
protected void tearDown() throws Exception {
LogFactory.getFactory().release();
LogManager.resetConfiguration();
super.tearDown();
}
内容来源于网络,如有侵权,请联系作者删除!