ch.qos.logback.core.joran.util.ConfigurationWatchListUtil Java Examples
The following examples show how to use
ch.qos.logback.core.joran.util.ConfigurationWatchListUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LogbackController.java From GreenSummer with GNU Lesser General Public License v2.1 | 6 votes |
/** * @return The list of log levels configured and their settings */ @RequestMapping(value = "reset", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET, headers = "Accept=application/json") @ResponseBody public ResponseEntity<LogResponse> reset() { final LoggerContext ctx = (LoggerContext) LoggerFactory.getILoggerFactory(); synchronized (ctx) { File configuration = ConfigurationWatchListUtil.getConfigurationWatchList(ctx).getCopyOfFileWatchList().get(0); JoranConfigurator configurator = new JoranConfigurator(); configurator.setContext(ctx); ctx.reset(); try { configurator.doConfigure(configuration); } catch (JoranException e) { log.error("Error re-applying the configuration"); } } return new ResponseEntity<>(listLoggers(ctx), HttpStatus.OK); }
Example #2
Source File: BaseCommand.java From emissary with Apache License 2.0 | 6 votes |
public void reinitLogback() { // Need to reinit because logback config uses ${emissary.node.name}-${emissary.node.port} // which are now set by the commands after logback is initialized LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); URL logCfg = ConfigurationWatchListUtil.getMainWatchURL(loggerContext); if (logCfg != null && (logCfg.toString().endsWith("logback-test.xml") || (logCfg.toString().endsWith("logback-test.groovy")))) { // logCfg can be null if Emissary.setupLogbackForConsole is called LOG.warn("Not using {}, staying with test config {}", getLogbackConfig(), logCfg.toString()); doLogbackReinit(loggerContext, logCfg.getPath()); } else if (Files.exists(Paths.get(getLogbackConfig()))) { doLogbackReinit(loggerContext, getLogbackConfig()); } else { LOG.warn("logback configuration not found {}, not reconfiguring logging", getLogbackConfig()); } }
Example #3
Source File: LogbackLogManager.java From seed with Mozilla Public License 2.0 | 4 votes |
private boolean isExplicitlyConfigured() { return ConfigurationWatchListUtil.getMainWatchURL(context) != null; }