LogbackLoggerResource implements SingletonRestResource { @GET @Produces(MediaType.TEXT_PLAIN) @Path("/change/to/error/{loggerName}") public String changeToError(@PathParam("loggerName") final String loggerName) { Logger logger = (Logger) LoggerFactory.getLogger(loggerName); changeLevel(logger, Level.ERROR); return getLevel(loggerName); }  @GET @Produces(MediaType.TEXT_PLAIN) @Path("/get/level/{loggerName}") String getLevel(@PathParam("loggerName") final String loggerName); @GET @Produces(MediaType.TEXT_PLAIN) @Path("/change/to/all/{loggerName}") String changeToAll(@PathParam("loggerName") final String loggerName); @GET @Produces(MediaType.TEXT_PLAIN) @Path("/change/to/debug/{loggerName}") String changeToDebug(@PathParam("loggerName") final String loggerName); @GET @Produces(MediaType.TEXT_PLAIN) @Path("/change/to/error/{loggerName}") String changeToError(@PathParam("loggerName") final String loggerName); @GET @Produces(MediaType.TEXT_PLAIN) @Path("/change/to/info/{loggerName}") String changeToInfo(@PathParam("loggerName") final String loggerName); @GET @Produces(MediaType.TEXT_PLAIN) @Path("/change/to/off/{loggerName}") String changeToOff(@PathParam("loggerName") final String loggerName); @GET @Produces(MediaType.TEXT_PLAIN) @Path("/change/to/trace/{loggerName}") String changeToTrace(@PathParam("loggerName") final String loggerName); @GET @Produces(MediaType.TEXT_PLAIN) @Path("/change/to/warn/{loggerName}") String changeToWarn(@PathParam("loggerName") final String loggerName);  }
@Test public void testChangeToError() { assertThat(logbackResource.changeToError(loggerName), is("ERROR")); }