KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > transaction > util > Log4jLogger


1 /*
2  * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//transaction/src/java/org/apache/commons/transaction/util/Log4jLogger.java,v 1.1 2004/11/18 23:27:18 ozeigermann Exp $
3 <<<<<<< .mine
4  * $Revision: 1.1 $
5  * $Date: 2005-02-26 14:16:14 +0100 (Sa, 26 Feb 2005) $
6 =======
7  * $Revision$
8  * $Date: 2005-02-26 14:16:14 +0100 (Sa, 26 Feb 2005) $
9 >>>>>>> .r168169
10  *
11  * ====================================================================
12  *
13  * Copyright 1999-2002 The Apache Software Foundation
14  *
15  * Licensed under the Apache License, Version 2.0 (the "License");
16  * you may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at
18  *
19  * http://www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  *
27  */

28
29 package org.apache.commons.transaction.util;
30
31 import org.apache.log4j.Logger;
32
33 /**
34  * Default logger implementation. Uses log4j logging.
35  *
36  * @version $Revision$
37  */

38 public class Log4jLogger implements LoggerFacade {
39     
40     protected Logger logger;
41     
42     public Log4jLogger(Logger logger) {
43         this.logger = logger;
44     }
45
46     public Logger getLogger() {
47         return logger;
48     }
49
50     public LoggerFacade createLogger(String JavaDoc name) {
51         return new Log4jLogger(Logger.getLogger(name));
52     }
53
54     public void logInfo(String JavaDoc message) {
55         logger.info(message);
56     }
57
58     public void logFine(String JavaDoc message) {
59         logger.debug(message);
60     }
61
62     public boolean isFineEnabled() {
63         return logger.isDebugEnabled();
64     }
65
66     public void logFiner(String JavaDoc message) {
67         logger.debug(message);
68     }
69
70     public boolean isFinerEnabled() {
71         return logger.isDebugEnabled();
72     }
73
74     public void logFinest(String JavaDoc message) {
75         logger.debug(message);
76     }
77
78     public boolean isFinestEnabled() {
79         return logger.isDebugEnabled();
80     }
81
82     public void logWarning(String JavaDoc message) {
83         logger.warn(message);
84     }
85
86     public void logWarning(String JavaDoc message, Throwable JavaDoc t) {
87         logger.warn(message, t);
88     }
89     public void logSevere(String JavaDoc message) {
90         logger.error(message);
91     }
92
93     public void logSevere(String JavaDoc message, Throwable JavaDoc t) {
94         logger.error(message, t);
95     }
96 }
97
Popular Tags