001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.kernel.log;
017:
018: import org.apache.commons.logging.Log;
019:
020: /**
021: * This log wrapper caches the trace, debug and info enabled flags. The flags are updated
022: * by a single timer task for all logs.
023: *
024: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
025: */
026: public final class GeronimoLog implements Log {
027: private final String name;
028: private Log log;
029:
030: public GeronimoLog(String name, Log log) {
031: this .name = name;
032: this .log = log;
033: }
034:
035: public String getName() {
036: return name;
037: }
038:
039: public Log getLog() {
040: return log;
041: }
042:
043: public void setLog(Log log) {
044: this .log = log;
045: }
046:
047: public boolean isTraceEnabled() {
048: return log.isTraceEnabled();
049: }
050:
051: public void trace(Object message) {
052: log.trace(message);
053: }
054:
055: public void trace(Object message, Throwable throwable) {
056: log.trace(message, throwable);
057: }
058:
059: public boolean isDebugEnabled() {
060: return log.isDebugEnabled();
061: }
062:
063: public void debug(Object message) {
064: log.debug(message);
065: }
066:
067: public void debug(Object message, Throwable throwable) {
068: log.debug(message, throwable);
069: }
070:
071: public boolean isInfoEnabled() {
072: return log.isInfoEnabled();
073: }
074:
075: public void info(Object message) {
076: if (!name.startsWith("/")) { //todo: temporary fix to work around Jetty logging issue
077: log.info(message);
078: }
079: }
080:
081: public void info(Object message, Throwable throwable) {
082: log.info(message, throwable);
083: }
084:
085: public boolean isWarnEnabled() {
086: return log.isWarnEnabled();
087: }
088:
089: public void warn(Object message) {
090: log.warn(message);
091: }
092:
093: public void warn(Object message, Throwable throwable) {
094: log.warn(message, throwable);
095: }
096:
097: public boolean isErrorEnabled() {
098: return log.isErrorEnabled();
099: }
100:
101: public void error(Object message) {
102: log.error(message);
103: }
104:
105: public void error(Object message, Throwable throwable) {
106: log.error(message, throwable);
107: }
108:
109: public boolean isFatalEnabled() {
110: return log.isFatalEnabled();
111: }
112:
113: public void fatal(Object message) {
114: log.fatal(message);
115: }
116:
117: public void fatal(Object message, Throwable throwable) {
118: log.fatal(message, throwable);
119: }
120: }
|