1 18 package org.objectweb.util.monolog; 19 20 import junit.framework.TestCase; 21 import org.objectweb.util.monolog.api.MonologFactory; 22 import org.objectweb.util.monolog.api.Logger; 23 import org.objectweb.util.monolog.api.BasicLevel; 24 25 29 public class TestSimple extends TestCase { 30 31 static MonologFactory mf = null; 32 33 public TestSimple(String s) { 34 super(s); 35 } 36 37 protected void setUp() throws Exception { 38 if (mf == null) { 39 synchronized(TestSimple.class) { 40 if (mf == null) { 41 mf = Monolog.getMonologFactory("monolog.properties"); 42 } 43 } 44 } 45 } 46 47 public void test1() { 48 logAllLevel(mf.getLogger("org.objectweb.util.monolog.test.fatal")); 49 logAllLevel(mf.getLogger("org.objectweb.util.monolog.test.error")); 50 logAllLevel(mf.getLogger("org.objectweb.util.monolog.test.warn")); 51 logAllLevel(mf.getLogger("org.objectweb.util.monolog.test.info")); 52 logAllLevel(mf.getLogger("org.objectweb.util.monolog.test.debug")); 53 } 54 55 private void logAllLevel(Logger logger) { 56 logger.log(BasicLevel.FATAL, "-----------------" 57 + "\n\tlogger.name: " + logger.getName() 58 + "\n\tlogger.class: " + logger.getClass().getName() 59 + "\n\tlevel=" + logger.getCurrentLevel().getName()); 60 logger.log(BasicLevel.FATAL, "message FATAL ..."); 61 logger.log(BasicLevel.ERROR, "message ERROR ..."); 62 logger.log(BasicLevel.WARN, "message WARN ..."); 63 logger.log(BasicLevel.INFO, "message INFO ..."); 64 logger.log(BasicLevel.DEBUG, "message DEBUG ..."); 65 } 66 67 } 68 | Popular Tags |