/** * Adds a {@link LogHandler} to the {@link TwillPreparer} based on the configuration. */ private void addLogHandler(TwillPreparer twillPreparer, CConfiguration cConf) { String confLevel = cConf.get(Constants.COLLECT_APP_CONTAINER_LOG_LEVEL).toUpperCase(); if ("OFF".equals(confLevel)) { twillPreparer.withConfiguration(Collections.singletonMap(Configs.Keys.LOG_COLLECTION_ENABLED, "false")); return; } LogEntry.Level logLevel = LogEntry.Level.ERROR; try { logLevel = "ALL".equals(confLevel) ? LogEntry.Level.TRACE : LogEntry.Level.valueOf(confLevel.toUpperCase()); } catch (Exception e) { LOG.warn("Invalid application container log level {}. Defaulting to ERROR.", confLevel); } twillPreparer.addLogHandler(new LoggerLogHandler(LOG, logLevel)); }
/** * Adds a {@link LogHandler} to the {@link TwillPreparer} based on the configuration. */ private void addLogHandler(TwillPreparer twillPreparer, CConfiguration cConf) { String confLevel = cConf.get(Constants.COLLECT_APP_CONTAINER_LOG_LEVEL).toUpperCase(); if ("OFF".equals(confLevel)) { twillPreparer.withConfiguration(Collections.singletonMap(Configs.Keys.LOG_COLLECTION_ENABLED, "false")); return; } LogEntry.Level logLevel = LogEntry.Level.ERROR; try { logLevel = "ALL".equals(confLevel) ? LogEntry.Level.TRACE : LogEntry.Level.valueOf(confLevel.toUpperCase()); } catch (Exception e) { LOG.warn("Invalid application container log level {}. Defaulting to ERROR.", confLevel); } twillPreparer.addLogHandler(new LoggerLogHandler(LOG, logLevel)); }
controller.addLogHandler(new LoggerLogHandler(LOG));