FileDocCategorySizeDatePackage
XLoggerTestCase.javaAPI DocApache log4j 1.2.152499Sat Aug 25 00:09:32 BST 2007org.apache.log4j.customLogger

XLoggerTestCase

public class XLoggerTestCase extends TestCase
Tests handling of custom loggers.
author
Ceki Gülcü

Fields Summary
static String
FILTERED
static XLogger
logger
Constructors Summary
public XLoggerTestCase(String name)


    
    super(name);
  
Methods Summary
voidcommon(int number)

    DOMConfigurator.configure("input/xml/customLogger"+number+".xml");

    int i = -1;
    Logger root = Logger.getRootLogger();

    logger.trace("Message " + ++i);
    logger.debug("Message " + ++i);
    logger.warn ("Message " + ++i);
    logger.error("Message " + ++i);
    logger.fatal("Message " + ++i);
    Exception e = new Exception("Just testing");
    logger.debug("Message " + ++i, e);

    Transformer.transform(
      "output/temp", FILTERED,
      new Filter[] {
        new LineNumberFilter(), new SunReflectFilter(),
        new JunitTestRunnerFilter()
      });
    assertTrue(Compare.compare(FILTERED, "witness/customLogger."+number));

  
public static junit.framework.Testsuite()

    TestSuite suite = new TestSuite();
    suite.addTest(new XLoggerTestCase("test1"));
    suite.addTest(new XLoggerTestCase("test2"));
    return suite;
  
public voidtearDown()

    logger.getLoggerRepository().resetConfiguration();
  
public voidtest1()

 common(1); 
public voidtest2()

 common(2);