OperationREST { @PUT @Path("/log/{level}") public Response setLogLevel( @PathParam("level") final String level, @QueryParam("package") final String packageName) { String targetLoggerName = "org.cloudfoundry.autoscaler"; if (packageName != null && !packageName.isEmpty()) targetLoggerName = packageName; Logger targetLogger = LogManager.getLogger(targetLoggerName); if (level.equalsIgnoreCase("INFO")) targetLogger.setLevel(Level.INFO); else if (level.equalsIgnoreCase("DEBUG")) targetLogger.setLevel(Level.DEBUG); else if (level.equalsIgnoreCase("ERROR")) targetLogger.setLevel(Level.ERROR); else if (level.equalsIgnoreCase("WARN")) targetLogger.setLevel(Level.WARN); else if (level.equalsIgnoreCase("FATAL")) targetLogger.setLevel(Level.FATAL); else if (level.equalsIgnoreCase("TRACE")) targetLogger.setLevel(Level.TRACE); else if (level.equalsIgnoreCase("OFF")) targetLogger.setLevel(Level.OFF); else if (level.equalsIgnoreCase("ALL")) targetLogger.setLevel(Level.ALL); logger.info("Log level " + level.toUpperCase() + " is set"); return RestApiResponseHandler.getResponseOk(); }  @PUT @Path("/log/{level}") Response setLogLevel( @PathParam("level") final String level, @QueryParam("package") final String packageName); @GET @Path("/info") Response info(); @GET @Path("/connection") Response connectoins();  }
@Test public void testSetLogLevel(){ WebResource webResource = resource(); MultivaluedMap<String, String> map = new MultivaluedMapImpl(); map.add("package", "org.cloudfoundry.autoscaler.metric.rest"); ClientResponse response = webResource.path("/operation/log/INFO").queryParams(map).put(ClientResponse.class); assertEquals(response.getStatus(), STATUS200); }