//======================================================================== //Copyright 1997-2006 Mort Bay Consulting Pty. Ltd. //------------------------------------------------------------------------ //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at //http://www.apache.org/licenses/LICENSE-2.0 //Unless required by applicable law or agreed to in writing, software //distributed under the License is distributed on an "AS IS" BASIS, //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //See the License for the specific language governing permissions and //limitations under the License. //======================================================================== package org.mortbay.jetty; import org.mortbay.jetty.RequestLog; import org.mortbay.component.LifeCycle; import org.mortbay.jetty.JettyServerLog4JConfig; /** * This {@link RequestLog} serves only as a wrapper for the * {@link Log4JRequestLog} implementation that is used to process the request * logging. This is only necessary because the {@link Log4JRequestLogImpl} that * implements the {@link Log4JRequestLog} must be instantiated via * ClassLoader.loadClass().newInstance(). With this wrapper, the default * constructor may be used for this RequestLog implementation, keeping the * configuration consistent. * * @author Chance Yeoman * * @org.apache.xbean.XBean element="Log4JRequestLogWrapper" */ public class Log4JRequestLogWrapper implements RequestLog, LifeCycle { private Log4JRequestLog wrappedLogger; public Log4JRequestLogWrapper() throws Exception { this.wrappedLogger = JettyServerLog4JConfig .getLog4JRequestLogInstance(); } /* ------------------------------------------------------------ */ /** * @param accessLoggerName * String name for the Logger instance. Used to configure * logger-specific appenders. */ public void setAccessLoggerName(final String accessLoggerName) { wrappedLogger.setAccessLoggerName(accessLoggerName); } /* ------------------------------------------------------------ */ /** * Remaining properties from NCSARequestLog implementation. */ public void setLogServer(boolean logServer) { wrappedLogger.setLogServer(logServer); } public void setPreferProxiedForAddress(boolean preferProxiedForAddress) { wrappedLogger.setPreferProxiedForAddress(preferProxiedForAddress); } public void setLogDateFormat(String logDateFormat) { wrappedLogger.setLogDateFormat(logDateFormat); } public void setLogTimeZone(String logTimeZone) { wrappedLogger.setLogTimeZone(logTimeZone); } public void setIgnorePaths(String[] ignorePaths) { wrappedLogger.setIgnorePaths(ignorePaths); } public void setExtended(boolean extended) { wrappedLogger.setExtended(extended); } public void setLogCookies(boolean logCookies) { wrappedLogger.setLogCookies(logCookies); } public void setLogLatency(boolean logLatency) { wrappedLogger.setLogLatency(logLatency); } /* ------------------------------------------------------------ */ /** * {@link org.mortbay.jetty.RequestLog#log(Request, Response)} */ public void log(Request arg0, Response arg1) { wrappedLogger.log(arg0, arg1); } /* ------------------------------------------------------------ */ /** * {@link org.mortbay.component.LifeCycle#isFailed()} */ public boolean isFailed() { return wrappedLogger.isFailed(); } /* ------------------------------------------------------------ */ /** * {@link org.mortbay.component.LifeCycle#isRunning()} */ public boolean isRunning() { return wrappedLogger.isRunning(); } /* ------------------------------------------------------------ */ /** * {@link org.mortbay.component.LifeCycle#isStarted()} */ public boolean isStarted() { return wrappedLogger.isStarted(); } /* ------------------------------------------------------------ */ /** * {@link org.mortbay.component.LifeCycle#isStarting()} */ public boolean isStarting() { return wrappedLogger.isStarting(); } /* ------------------------------------------------------------ */ /** * {@link org.mortbay.component.LifeCycle#isStopped()} */ public boolean isStopped() { return wrappedLogger.isStopped(); } /* ------------------------------------------------------------ */ /** * {@link org.mortbay.component.LifeCycle#isStopping()} */ public boolean isStopping() { return wrappedLogger.isStopping(); } /* ------------------------------------------------------------ */ /** * {@link org.mortbay.component.LifeCycle#start()} */ public void start() throws Exception { wrappedLogger.start(); } /* ------------------------------------------------------------ */ /** * {@link org.mortbay.component.LifeCycle#stop()} */ public void stop() throws Exception { wrappedLogger.stop(); } }