try {
String loggerName = path.segment(0);
JSONObject toPut = OrionServlet.readJSONRequest(request);
Logger logger = logService.getLogger(loggerName);
if (logger == null) {
final String msg = NLS
.bind("Logger not found: {0}", loggerName);
final ServerStatus error = new ServerStatus(IStatus.ERROR,
HttpServletResponse.SC_NOT_FOUND, msg, null);
return statusHandler.handleRequest(request, response, error);
}
String putlevel = toPut.getString(LogConstants.KEY_LOGGER_LEVEL);
Level level = Level.toLevel(putlevel, logger.getLevel());
logger.setLevel(level);
LoggerResource loggerResource = new LoggerResource();
loggerResource.setBaseLocation(baseLocation);
loggerResource.setName(logger.getName());
loggerResource.setLevel(logger.getLevel());
loggerResource.setEffectiveLevel(logger.getEffectiveLevel());
JSONObject result = loggerResource.toJSON();
OrionServlet.writeJSONResponse(request, response, result);
response.setHeader(ProtocolConstants.HEADER_LOCATION,
result.getString(ProtocolConstants.KEY_LOCATION));