null);
if (level == null) {
throw new BadRequestException("Invalid level: "
+ query.getQueryStringParam("level"));
}
final Logger root =
(Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
String logger_name = query.getQueryStringParam("logger");
if (logger_name == null) {
logger_name = Logger.ROOT_LOGGER_NAME;
} else if (root.getLoggerContext().exists(logger_name) == null) {
throw new BadRequestException("Invalid logger: " + logger_name);
}
final Logger logger = (Logger) LoggerFactory.getLogger(logger_name);
int nloggers = 0;
if (logger == root) { // Update all the loggers.
for (final Logger l : logger.getLoggerContext().getLoggerList()) {
l.setLevel(level);
nloggers++;
}
} else {
logger.setLevel(level);
nloggers++;
}
query.sendReply("Set the log level to " + level + " on " + nloggers
+ " logger" + (nloggers > 1 ? "s" : "") + ".\n");
} else {