throw sce;
}
private LoggerTO setLevel(final String name, final Level level, final LoggerType expectedType) {
SyncopeLogger syncopeLogger = loggerDAO.find(name);
if (syncopeLogger == null) {
LOG.debug("Logger {} not found: creating new...", name);
syncopeLogger = new SyncopeLogger();
syncopeLogger.setName(name);
syncopeLogger.setType(name.startsWith(LoggerType.AUDIT.getPrefix())
? LoggerType.AUDIT
: LoggerType.LOG);
}
if (expectedType != syncopeLogger.getType()) {
throwInvalidLogger(expectedType);
}
syncopeLogger.setLevel(LoggerLevel.fromLevel(level));
syncopeLogger = loggerDAO.save(syncopeLogger);
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
LoggerConfig logConf = SyncopeConstants.ROOT_LOGGER.equals(name)
? ctx.getConfiguration().getLoggerConfig(LogManager.ROOT_LOGGER_NAME)