public static org.apache.logging.log4j.Level getLevel(org.apache.logging.log4j.Logger logger) { if(logger instanceof org.apache.logging.log4j.core.Logger) { return ((org.apache.logging.log4j.core.Logger) logger).getLevel(); } else if(logger instanceof SimpleLogger) { return ((SimpleLogger) logger).getLevel(); } else { return null; } }
public static void setLevel(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level) { if(logger instanceof org.apache.logging.log4j.core.Logger) { ((org.apache.logging.log4j.core.Logger) logger).setLevel(level); } else if(logger instanceof SimpleLogger) { ((SimpleLogger) logger).setLevel(level); } }
public void setLevel(String level) { Level new_level=strToLevel(level); if(new_level == null) return; if(logger instanceof org.apache.logging.log4j.core.Logger) ((org.apache.logging.log4j.core.Logger)logger).setLevel(new_level); else if(logger instanceof SimpleLogger) ((SimpleLogger)logger).setLevel(new_level); }
public static void main() { PrintStream ps = new PrintStream(new FileOutputStream(FileDescriptor.out)); MyTown.instance = new MyTown(); MyTown.instance.LOG = new SimpleLogger("MyTown2-Test", Level.INFO, true, true, false, false, "DD/MM/YY", null, PropertiesUtil.getProperties(), ps); ps = new PrintStream(new FileOutputStream(FileDescriptor.out)); MyEssentialsCore.instance = new MyEssentialsCore(); MyEssentialsCore.instance.LOG = new SimpleLogger("MyEssentials-Core-Test", Level.INFO, true, true, false, false, "DD/MM/YY", null, PropertiesUtil.getProperties(), ps); }
private StatusLogger(final String name, final MessageFactory messageFactory) { super(name, messageFactory); this.logger = new SimpleLogger("StatusLogger", Level.ERROR, false, true, false, false, Strings.EMPTY, messageFactory, PROPS, System.err); this.listenersLevel = Level.toLevel(DEFAULT_STATUS_LEVEL, Level.WARN).intLevel(); // LOG4J2-1813 if system property "log4j2.debug" is defined, print all status logging if (isDebugPropertyEnabled()) { logger.setLevel(Level.TRACE); } }
private StatusLogger() { this.logger = new SimpleLogger("StatusLogger", Level.ERROR, false, true, false, false, "", null, PROPS, System.err); this.listenersLevel = Level.toLevel(DEFAULT_STATUS_LEVEL, Level.WARN).intLevel(); }