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 11package test; 12 13import junit.framework.TestCase; 14 15import org.apache.log4j.Logger; 16import org.apache.log4j.MDC; 17 18/** 19 * 20 * A test case that issues the typical calls 21 * that an application using log4j 1.3 would do. 22 * 23 * @author Ceki Gülcü 24 * @author Sébastien Pennec 25 */ 26 27public class Log4j13Calls extends TestCase { 28 public static final Logger logger = Logger.getLogger(Log4j12Calls.class); 29 30 public void testLog() { 31 MDC.put("key", "value1"); 32 33 logger.trace("Trace level can be noisy"); 34 logger.debug("Entering application"); 35 logger.info("Violets are blue"); 36 logger.warn("Here is a warning"); 37 logger.info("The answer is {}.", new Integer(42)); 38 logger.info("Number: {} and another one: {}.", new Integer(42), new Integer(24)); 39 40 logger.error("Exiting application", new Exception("just testing")); 41 42 MDC.remove("key"); 43 44 MDC.clear(); 45 } 46} 47