if (logger.getLevel() != null) {
if (loggerLogs.containsKey(logger.getName())) {
logger.setLevel(loggerLogs.get(logger.getName()).getLevel().getLevel());
loggerLogs.remove(logger.getName());
} else if (!logger.getName().equals(SyncopeLoggerType.AUDIT.getPrefix())) {
SyncopeLogger syncopeLogger = new SyncopeLogger();
syncopeLogger.setName(logger.getName());
syncopeLogger.setLevel(SyncopeLoggerLevel.fromLevel(logger.getLevel()));
syncopeLogger.setType(logger.getName().startsWith(SyncopeLoggerType.AUDIT.getPrefix())
? SyncopeLoggerType.AUDIT
: SyncopeLoggerType.LOG);
loggerDAO.save(syncopeLogger);
}
}
}
/*
* Foreach SyncopeLogger not found in Logback, create a new Logback logger with given name and level.
*/
for (SyncopeLogger syncopeLogger : loggerLogs.values()) {
Logger logger = lc.getLogger(syncopeLogger.getName());
logger.setLevel(syncopeLogger.getLevel().getLevel());
}
}