001: /*
002: Copyright (C) 2006 MySQL AB
003:
004: This program is free software; you can redistribute it and/or modify
005: it under the terms of version 2 of the GNU General Public License as
006: published by the Free Software Foundation.
007:
008: There are special exceptions to the terms and conditions of the GPL
009: as it is applied to this software. View the full text of the
010: exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
011: software distribution.
012:
013: This program is distributed in the hope that it will be useful,
014: but WITHOUT ANY WARRANTY; without even the implied warranty of
015: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: GNU General Public License for more details.
017:
018: You should have received a copy of the GNU General Public License
019: along with this program; if not, write to the Free Software
020: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021:
022: */
023:
024: package com.mysql.jdbc.log;
025:
026: import org.apache.commons.logging.Log;
027: import org.apache.commons.logging.LogFactory;
028:
029: public class CommonsLogger implements com.mysql.jdbc.log.Log {
030: private Log logger;
031:
032: public CommonsLogger(String instanceName) {
033: logger = LogFactory.getLog(instanceName);
034: }
035:
036: public boolean isDebugEnabled() {
037: return this .logger.isInfoEnabled();
038: }
039:
040: public boolean isErrorEnabled() {
041: return this .logger.isErrorEnabled();
042: }
043:
044: public boolean isFatalEnabled() {
045: return this .logger.isFatalEnabled();
046: }
047:
048: public boolean isInfoEnabled() {
049: return this .logger.isInfoEnabled();
050: }
051:
052: public boolean isTraceEnabled() {
053: return this .logger.isTraceEnabled();
054: }
055:
056: public boolean isWarnEnabled() {
057: return this .logger.isWarnEnabled();
058: }
059:
060: public void logDebug(Object msg) {
061: this .logger.debug(LogUtils.expandProfilerEventIfNecessary(msg));
062: }
063:
064: public void logDebug(Object msg, Throwable thrown) {
065: this .logger.debug(LogUtils.expandProfilerEventIfNecessary(msg),
066: thrown);
067: }
068:
069: public void logError(Object msg) {
070: this .logger.error(LogUtils.expandProfilerEventIfNecessary(msg));
071: }
072:
073: public void logError(Object msg, Throwable thrown) {
074: this .logger.fatal(LogUtils.expandProfilerEventIfNecessary(msg),
075: thrown);
076: }
077:
078: public void logFatal(Object msg) {
079: this .logger.fatal(LogUtils.expandProfilerEventIfNecessary(msg));
080: }
081:
082: public void logFatal(Object msg, Throwable thrown) {
083: this .logger.fatal(LogUtils.expandProfilerEventIfNecessary(msg),
084: thrown);
085: }
086:
087: public void logInfo(Object msg) {
088: this .logger.info(LogUtils.expandProfilerEventIfNecessary(msg));
089: }
090:
091: public void logInfo(Object msg, Throwable thrown) {
092: this .logger.info(LogUtils.expandProfilerEventIfNecessary(msg),
093: thrown);
094: }
095:
096: public void logTrace(Object msg) {
097: this .logger.trace(LogUtils.expandProfilerEventIfNecessary(msg));
098: }
099:
100: public void logTrace(Object msg, Throwable thrown) {
101: this .logger.trace(LogUtils.expandProfilerEventIfNecessary(msg),
102: thrown);
103: }
104:
105: public void logWarn(Object msg) {
106: this .logger.warn(LogUtils.expandProfilerEventIfNecessary(msg));
107: }
108:
109: public void logWarn(Object msg, Throwable thrown) {
110: this.logger.warn(LogUtils.expandProfilerEventIfNecessary(msg),
111: thrown);
112: }
113:
114: }
|