KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > util > logger > TxLogger


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/logger/TxLogger.java,v 1.3 2004/07/19 12:39:42 ozeigermann Exp $
3  * $Revision: 1.3 $
4  * $Date: 2004/07/19 12:39:42 $
5  *
6  * ====================================================================
7  *
8  * Copyright 2004 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.util.logger;
25
26 import org.apache.commons.transaction.util.LoggerFacade;
27
28 /**
29  * Mapper from Slide logging to commons tx logging.
30  *
31  * @version $Revision: 1.3 $
32  */

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