1 22 package org.objectweb.petals.util.monolog.wrapper.javalog; 23 24 import java.io.File ; 25 26 import junit.framework.TestCase; 27 28 import org.objectweb.util.monolog.Monolog; 29 30 35 public class LoggerTest extends TestCase { 36 37 private org.objectweb.util.monolog.api.LoggerFactory loggerFactory; 38 39 public void setUp() { 40 String baseDir = this.getClass().getResource(".").toString(); 41 baseDir = baseDir.substring(0, baseDir.indexOf("target")); 42 baseDir = baseDir.substring(baseDir.indexOf(":")+1); 43 44 System.setProperty("monolog.filename", baseDir + "src" + File.separator 45 + "test-data" + File.separator + "monolog.properties"); 46 loggerFactory = Monolog.initialize(); 47 } 48 49 public void testGetLoggerCheckParent() { 50 Logger rootLogger = (Logger) loggerFactory.getLogger("root"); 51 Logger compo1Logger = (Logger) loggerFactory.getLogger("root.compo1"); 52 assertEquals(compo1Logger.getParent(), rootLogger); 53 } 54 55 public void testGetLoggerEquals() { 56 Logger rootLogger = (Logger) loggerFactory.getLogger("root"); 57 Logger rootLogger1 = (Logger) loggerFactory.getLogger("root"); 58 assertEquals(rootLogger1, rootLogger); 59 } 60 61 } 62 | Popular Tags |