//======================================================================== //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.Log4JConfigLoader; import org.apache.log4j.xml.DOMConfigurator; /* ------------------------------------------------------------ */ /** * This {@link Log4JConfigLoader} implementation simply calls the static * DOMConfigurator.configure() Log4J method to apply the specified config file * to all Log4J Loggers created within this server logging specific class * loader. The interface and implementation is to allow the configuration to be * set from the server without loading any log4j classes within it's class * loader. * * This mechanism is kept separate from the RequestLog implementation as the * configuration loaded here could also be applied to server logging for * mechanisms other than request logs if they are later added. * * @author Chance Yeoman */ public class Log4JConfigLoaderImpl implements Log4JConfigLoader { public Log4JConfigLoaderImpl() { } /** * Calls the static log4j DOMConfigurator.configure() method using the * specified file path. Note that this is an instance method that performs a * configuration that is static. The JettyServerLog4JConfig Class should * take care that the configuration is only performed once. * * @param pathToFile * - String path to the configuration file. */ public void loadLog4JConfig(String pathToFile) { DOMConfigurator.configure(pathToFile); } }