1 import org.apache.log4j.Logger;
2
3 /**
4 * <p>
5 * Wraps a Log4j Logger. This non-public class is the one actually interacting
6 * with the log4j.jar library. That way LogWrapper can safely attempt to use
7 * log4j.jar, but still degrade gracefully and provide logging via standard-out
8 * even if log4j is unavailable.
9 * <p>
10 * The interactions with log4j.jar could be done directly inside LogWrapper
11 * as long as the Java code is compiled by Java 1.4 or greater (still works
12 * at runtime in Java 1.3). The interactions with log4j.jar only need to be
13 * pushed out into a separate class like this for people using a Java 1.3
14 * compiler, which creates bytecode that is more strict with depedency
15 * checking.
16 *
17 * @author Credit Union Central of British Columbia
18 * @author <a href="http://www.cucbc.com/">www.cucbc.com</a>
19 * @author <a href="mailto:juliusdavies@cucbc.com">juliusdavies@cucbc.com</a>
20 * @since 3-Aug-2006
21 */
22 final class LogHelper
23 {
24 private final Logger l;
25 LogHelper( Class c ) { l = Logger.getLogger( c ); }
26 LogHelper( String s ) { l = Logger.getLogger( s ); }
27 void debug(Object o) { l.debug(o); }
28 void debug(Object o, Throwable t) { l.debug(o,t); }
29 void info (Object o) { l.info(o); }
30 void info (Object o, Throwable t) { l.info(o,t); }
31 void warn (Object o) { l.warn(o); }
32 void warn (Object o, Throwable t) { l.warn(o,t); }
33 void error(Object o) { l.error(o); }
34 void error(Object o, Throwable t) { l.error(o,t); }
35 void fatal(Object o) { l.fatal(o); }
36 void fatal(Object o, Throwable t) { l.fatal(o,t); }
37 boolean isDebugEnabled() { return l.isDebugEnabled(); }
38 boolean isInfoEnabled() { return l.isInfoEnabled(); }
39 Object getLog4jLogger() { return l; }
40 }
41