01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.apache.openejb.util;
18:
19: import org.apache.log4j.Level;
20:
21: public class Log4jLogStream implements LogStream {
22: protected org.apache.log4j.Logger logger;
23:
24: public Log4jLogStream(LogCategory logCategory) {
25: logger = org.apache.log4j.Logger.getLogger(logCategory
26: .getName());
27: }
28:
29: public boolean isFatalEnabled() {
30: return logger.isEnabledFor(Level.FATAL);
31: }
32:
33: public void fatal(String message) {
34: logger.fatal(message);
35: }
36:
37: public void fatal(String message, Throwable t) {
38: logger.fatal(message, t);
39: }
40:
41: public boolean isErrorEnabled() {
42: return logger.isEnabledFor(Level.ERROR);
43: }
44:
45: public void error(String message) {
46: logger.error(message);
47: }
48:
49: public void error(String message, Throwable t) {
50: logger.error(message, t);
51: }
52:
53: public boolean isWarnEnabled() {
54: return logger.isEnabledFor(Level.WARN);
55: }
56:
57: public void warn(String message) {
58: logger.warn(message);
59: }
60:
61: public void warn(String message, Throwable t) {
62: logger.warn(message, t);
63: }
64:
65: public boolean isInfoEnabled() {
66: return logger.isInfoEnabled();
67: }
68:
69: public void info(String message) {
70: logger.info(message);
71: }
72:
73: public void info(String message, Throwable t) {
74: logger.info(message, t);
75: }
76:
77: public boolean isDebugEnabled() {
78: return logger.isDebugEnabled();
79: }
80:
81: public void debug(String message) {
82: logger.debug(message);
83: }
84:
85: public void debug(String message, Throwable t) {
86: logger.debug(message, t);
87: }
88: }
|