public static LoggingFraction loggingFraction() { String prop = System.getProperty(LoggingProperties.LOGGING); LoggingFraction fraction = null; if (prop != null) { prop = prop.trim().toLowerCase(); if (prop.equals("debug")) { fraction = LoggingFraction.createDebugLoggingFraction(); } else if (prop.equals("trace")) { fraction = LoggingFraction.createTraceLoggingFraction(); } } if (fraction == null) { fraction = LoggingFraction.createDefaultLoggingFraction(); } fraction.logger(new Logger("org.openshift.ping") .level(Level.TRACE)); fraction.logger(new Logger("org.jgroups.protocols.openshift") .level(Level.TRACE)); return fraction; }
public LoggingFraction applyDefaults(Level level) { defaultColorFormatter() .consoleHandler(Level.ALL, COLOR_PATTERN) .rootLogger(level, CONSOLE); Properties allProps = System.getProperties(); for (String name : allProps.stringPropertyNames()) { if (isSimpleLoggerName(name)) { String logger = name.substring((LoggingProperties.LOGGING + ".").length()); try { Level loggerLevel = Level.valueOf(allProps.getProperty(name).trim().toUpperCase()); logger(logger, (l) -> { l.level(loggerLevel); l.category(logger); }); } catch (IllegalArgumentException e) { // apparently wasn't a logging category+level, ignore. } } } return this; }
private void apply(LevelNode node) { if (!node.getName().equals("")) { this.fraction.logger(node.getName(), (l) -> { l.level(Level.valueOf(node.getLevel().toString())); }); } for (LevelNode each : node.getChildren()) { apply(each); } } }
private void apply(LevelNode node, LoggingFraction fraction) { if (!node.getName().equals("")) { fraction.logger(node.getName(), (l) -> { l.level(Level.valueOf(node.getLevel().toString())); }); } for (LevelNode each : node.getChildren()) { apply(each, fraction); } }