Log4jResource { @PUT @Path ( "/reload" ) @StatusCodes( { @ResponseCode( code = 200, condition = "Successfully reload from configuration." ) } ) @Produces( { MediaType.TEXT_PLAIN } ) public Response reloadConfiguration() throws Exception { LOGGER.setLevel( Level.INFO ); LOGGER.info( "Reloading configuration..." ); DOMConfigurator.configure( Loader.getResource( CONFIG ) ); return Response.ok( "Done" ).build(); }  @PUT @Path ( "/reload" ) @StatusCodes( { @ResponseCode( code = 200, condition = "Successfully reload from configuration." ) } ) @Produces( { MediaType.TEXT_PLAIN } ) Response reloadConfiguration(); @PUT @Path ( "/update" ) @StatusCodes( { @ResponseCode( code = 200, condition = "Successfully update log level." ), @ResponseCode( code = 304, condition = "Log level is not modified." ) } ) @Produces( { MediaType.TEXT_PLAIN } ) Response updateLogLevel( @FormParam(  "level" ) String targetLevel, @FormParam( "category" ) String category );  }
@Test public void resetLogLevel() throws Exception { Logger root = LogManager.getRootLogger(); Level initialLevel = root.getLevel(); assertNotEquals( initialLevel, Level.ALL ); root.setLevel( Level.ALL ); assertEquals( Level.ALL, root.getLevel() ); Response res = target.reloadConfiguration(); assertNotEquals( Level.ALL, LogManager.getRootLogger().getLevel() ); assertEquals( "Done", res.getEntity().toString() ); }