1 /**
2  * Logback: the reliable, generic, fast and flexible logging framework.
3  *
4  * Copyright (C) 1999-2006, QOS.ch
5  *
6  * This library is free software, you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by the Free
8  * Software Foundation.
9  */
10 package test;
11 
12 import junit.framework.TestCase;
13 
14 import org.apache.log4j.Logger;
15 import org.apache.log4j.MDC;
16 
17 /**
18  *
19  * A test case that issues the typical calls
20  * that an application using log4j 1.2 would do.
21  *
22  * @author Ceki Gülcü
23  * @author Sébastien Pennec
24  */
25 public class Log4j12Calls extends TestCase {
26   public static final Logger logger = Logger.getLogger(Log4j12Calls.class);
27 
testLog()28   public void testLog() {
29     MDC.put("key", "value1");
30 
31     logger.trace("Trace level can be noisy");
32     logger.debug("Entering application");
33     logger.info("Violets are blue");
34     logger.warn("Here is a warning");
35     logger.error("Exiting application", new Exception("just testing"));
36 
37     MDC.remove("key");
38   }
39 }
40