01: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.container.services.log;
07:
08: import org.apache.pluto.services.log.Logger;
09: import org.apache.commons.logging.Log;
10: import org.apache.commons.logging.LogFactory;
11:
12: /**
13: * Implementation of Apache Pluto Logger by delegation to Apache Commons Logging.
14: * @author Ken Weiner, kweiner@unicon.net
15: * @author andrew.petro@yale.edu
16: * @version $Revision: 35854 $
17: */
18: public class LoggerImpl implements Logger {
19: private final Log log;
20:
21: public LoggerImpl() {
22: // TODO: revisit to obtain correct logger for this case.
23: this .log = LogFactory.getLog(LoggerImpl.class);
24: }
25:
26: public LoggerImpl(String component) {
27: this .log = LogFactory.getLog(component);
28: }
29:
30: /**
31: * Instantiate a LoggerImpl for a particular class.
32: * This implementation passes the class to the Commons
33: * LogFactory to obtain the underlying Apache Commons Log
34: * implementation.
35: * @param klass - the class for which a logger is desired
36: */
37: public LoggerImpl(Class klass) {
38: this .log = LogFactory.getLog(klass);
39: }
40:
41: // Logger methods
42:
43: public boolean isDebugEnabled() {
44: return this .log.isDebugEnabled();
45: }
46:
47: public boolean isInfoEnabled() {
48: return this .log.isInfoEnabled();
49: }
50:
51: public boolean isWarnEnabled() {
52: return this .log.isWarnEnabled();
53: }
54:
55: public boolean isErrorEnabled() {
56: return this .log.isErrorEnabled();
57: }
58:
59: public void debug(String aMessage) {
60: this .log.debug(aMessage);
61: }
62:
63: public void debug(String aMessage, Throwable aThrowable) {
64: this .log.debug(aMessage, aThrowable);
65: }
66:
67: public void info(String aMessage) {
68: this .log.info(aMessage);
69: }
70:
71: public void warn(String aMessage) {
72: this .log.warn(aMessage);
73: }
74:
75: public void error(String aMessage) {
76: this .log.error(aMessage);
77: }
78:
79: public void error(String aMessage, Throwable aThrowable) {
80: this .log.error(aMessage, aThrowable);
81: }
82:
83: public void error(Throwable aThrowable) {
84: this.log.error(aThrowable, aThrowable);
85: }
86:
87: }
|