Ihar Hancharenka 5dff80e88e first
2023-03-27 16:52:17 +03:00

13 строки
464 B
Plaintext

LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
// LoggerContext ctx = LoggerContext.getContext();
Configuration cfg = ctx.getConfiguration();
...
ctx.updateLoggers();
if (saveLog4j2Config == null) {
System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
} else {
System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, saveLog4j2Config);
((LoggerContext) LogManager.getContext(false)).reconfigure();
}