String type = (String) values.get("type");
String name = (String) values.get("name");
String level = (String) values.get("level");
String pattern = (String) values.get("pattern");
LoggingOutput appender = loggingService.getOutputConfiguration(id);
if(appender == null) {
// type information required
Preconditions.checkArgument(type != null, "appender type was not given");
Preconditions.checkArgument(name != null, "appender name was not given");
if("logfile".equals(type)) {
String file = (String) values.get("file");
Preconditions.checkArgument(file != null, "logfile name was not given");
appender = loggingService.createLogFileOutput(id,name,file);
} else if("syslog".equals(type)) {
String host = (String) values.get("host");
Preconditions.checkArgument(host != null, "syslog host was not given");
appender = loggingService.createSyslogOutput(id,name);
} else {
throw new UnsupportedOperationException("new appenders of type "+type+" not supported");
}
}
appender.setName(name);
if(level != null) {
appender.setMaxLevel(Level.toLevel(level));
}
if(pattern != null) {
appender.setPattern(pattern);
}
if(values.get("file") != null && appender instanceof LogFileOutput) {
((LogFileOutput) appender).setFileName((String) values.get("file"));
}
if(values.get("keep") != null && appender instanceof LogFileOutput) {