DeveloperUtilsFragmentController { @AppAction(EmrConstants.APP_DEVELOPER) public void setReportProfilingEnabled(@RequestParam("enabled") boolean enabled) { if (enabled) { LogManager.getLogger(EvaluationProfiler.class).setLevel(Level.TRACE); LogManager.getLogger("org.openmrs.api").setLevel(Level.WARN); } else { LogManager.getLogger(EvaluationProfiler.class).setLevel(null); LogManager.getLogger("org.openmrs.api").setLevel(Level.INFO); } }  @AppAction(EmrConstants.APP_DEVELOPER) SimpleObject executeGroovy(@RequestParam("script") String script); @AppAction(EmrConstants.APP_DEVELOPER) SimpleObject getReportProfilingEnabled(); @AppAction(EmrConstants.APP_DEVELOPER) void setReportProfilingEnabled(@RequestParam("enabled") boolean enabled); @AppAction(EmrConstants.APP_DEVELOPER) List<SimpleObject> validatePatients(UiUtils ui);  }
@Test public void setReportProfilingEnabled() { Level oldProfilerLevel = LogManager.getLogger(EvaluationProfiler.class).getLevel(); Level oldServiceLevel = LogManager.getLogger("org.openmrs.api").getLevel(); controller.setReportProfilingEnabled(true); Assert.assertThat(LogManager.getLogger(EvaluationProfiler.class).getLevel(), is(Level.TRACE)); Assert.assertThat(LogManager.getLogger("org.openmrs.api").getLevel(), is(Level.WARN)); controller.setReportProfilingEnabled(false); Assert.assertThat(LogManager.getLogger(EvaluationProfiler.class).getLevel(), nullValue()); Assert.assertThat(LogManager.getLogger("org.openmrs.api").getLevel(), is(Level.INFO)); LogManager.getLogger(EvaluationProfiler.class).setLevel(oldProfilerLevel); LogManager.getLogger("org.openmrs.api").setLevel(oldServiceLevel); }