unsetLoggerLevel(name);
return;
}
logger.debug("Set logger level: {}={}", name, level);
LoggerLevel calculated = null;
if (Logger.ROOT_LOGGER_NAME.equals(name)) {
try {
calculated = LoggerLevel.DEFAULT.equals(level) ? LoggerLevel.INFO : level;
Properties logProperties = loadConfigurationProperties();
logProperties.setProperty(KEY_ROOT_LEVEL, calculated.name());
saveConfigurationProperties(logProperties);
}
catch (IOException e) {
throw Throwables.propagate(e);
}
}
else {
if (LoggerLevel.DEFAULT.equals(level)) {
boolean customizedByUser = overrides.containsKey(name) && !customisations.containsKey(name);
unsetLoggerLevel(name);
if (customizedByUser) {
overrides.put(name, calculated = getLoggerEffectiveLevel(name));
LogbackOverrides.write(getLogOverridesConfigFile(), overrides);
}
else {
LoggerLevel customizedLevel = customisations.get(name);
if (customizedLevel != null && !LoggerLevel.DEFAULT.equals(customizedLevel)) {
calculated = customizedLevel;
}
}
}