SHARE
TWEET

Untitled

a guest Mar 20th, 2017 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void changeLogLevel(String logLevel) {
  2.         final Level formerLogLevel = LogManager.getRootLogger().getLevel();
  3.         final Level newLogLevel = Level.toLevel(logLevel);
  4.         LogManager.getRootLogger().setLevel(newLogLevel);
  5.  
  6.         final Enumeration currentLoggers = getLoggerRepository().getCurrentLoggers();
  7.         while (currentLoggers.hasMoreElements()) {
  8.             logger.setLevel(newLogLevel);
  9.         }
  10.         auditEventService.saveAuditEvent(LOG_LEVEL_UPDATE_OK, "Log level was changed from: " + formerLogLevel.toString() + " to: " + logLevel);
  11.         log.fatal("after log level change, testing FATAL");
  12.         log.error("after log level change, testing ERROR");
  13.         log.warn("after log level change, testing WARN");
  14.         log.info("after log level change, testing INFO");
  15.         log.debug("after log level change, testing DEBUG");
  16.         log.trace("after log level change, testing TRACE");
  17.     }
RAW Paste Data
Top