001/*
002 * (C) Copyright 2006-2009 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id$
020 */
021
022package org.nuxeo.runtime.jetty;
023
024import org.apache.commons.logging.Log;
025import org.mortbay.log.Logger;
026
027/**
028 * Dumb logger to see what happens in Jetty.
029 *
030 * @author Thierry Delprat
031 */
032public class Log4JLogger implements Logger {
033
034    protected final Log logger;
035
036    public Log4JLogger(Log logger) {
037        this.logger = logger;
038    }
039
040    @Override
041    public void debug(String msg, Throwable th) {
042        logger.debug(msg, th);
043    }
044
045    @Override
046    public void debug(String msg, Object arg0, Object arg1) {
047        logger.debug(String.format(msg, arg0, arg1));
048    }
049
050    @Override
051    public Logger getLogger(String name) {
052        return this;
053    }
054
055    @Override
056    public void info(String msg, Object arg0, Object arg1) {
057        logger.info(String.format(msg, arg0, arg1));
058    }
059
060    @Override
061    public boolean isDebugEnabled() {
062        return logger.isDebugEnabled();
063    }
064
065    @Override
066    public void setDebugEnabled(boolean enabled) {
067    }
068
069    @Override
070    public void warn(String msg, Throwable th) {
071        logger.warn(msg, th);
072    }
073
074    @Override
075    public void warn(String msg, Object arg0, Object arg1) {
076        logger.warn(String.format(msg, arg0, arg1));
077    }
078
079}