SystemLogger extends Logger { public void warn(Throwable t, final Object ... args) { if(!level.shouldLog(Level.WARN)) { return; } System.err.println("[WARN] " + name + ": " + getString(args) + ": " + t.getMessage()); t.printStackTrace(); } SystemLogger(final String name); boolean isDebugEnabled(); void debug(Throwable t, final Object ... args); void debug(final Object ... args); void info(Throwable t, final Object ... args); void info(final Object ... args); void warn(Throwable t, final Object ... args); void warn(final Object ... args); void error(Throwable t, final Object ... args); void error(final Object ... args); static final String PROPERTY_LOG_LEVEL; }
@Test public void testWarn() throws Exception { System.setProperty(SystemLogger.PROPERTY_LOG_LEVEL, "warn"); SystemLogger logger = new SystemLogger("testlogger.warn"); logger.debug("debug"); logger.warn("warn"); }