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 */ 017package org.apache.log4j; 018 019import java.io.InputStream; 020import java.net.URL; 021import java.util.Properties; 022 023import org.apache.log4j.spi.LoggerRepository; 024 025/** 026 * A configurator for properties. 027 */ 028public class PropertyConfigurator { 029 030 /** 031 * Read configuration options from configuration file. 032 * 033 * @param configFileName The configuration file 034 * @param hierarchy The hierarchy 035 */ 036 public void doConfigure(final String configFileName, final LoggerRepository hierarchy) { 037 038 } 039 040 /** 041 * Read configuration options from <code>properties</code>. 042 * 043 * See {@link #doConfigure(String, LoggerRepository)} for the expected format. 044 * 045 * @param properties The properties 046 * @param hierarchy The hierarchy 047 */ 048 public void doConfigure(final Properties properties, final LoggerRepository hierarchy) { 049 } 050 051 /** 052 * Read configuration options from an InputStream. 053 * 054 * @param inputStream The input stream 055 * @param hierarchy The hierarchy 056 */ 057 public void doConfigure(final InputStream inputStream, final LoggerRepository hierarchy) { 058 } 059 060 /** 061 * Read configuration options from url <code>configURL</code>. 062 * 063 * @param configURL The configuration URL 064 * @param hierarchy The hierarchy 065 */ 066 public void doConfigure(final URL configURL, final LoggerRepository hierarchy) { 067 } 068 069 /** 070 * Read configuration options from configuration file. 071 * 072 * @param configFileName The configuration file. 073 */ 074 public static void configure(final String configFileName) { 075 } 076 077 /** 078 * Read configuration options from url <code>configURL</code>. 079 * 080 * @param configURL The configuration URL 081 */ 082 public static void configure(final URL configURL) { 083 } 084 085 /** 086 * Reads configuration options from an InputStream. 087 * 088 * @param inputStream The input stream 089 */ 090 public static void configure(final InputStream inputStream) { 091 } 092 093 /** 094 * Read configuration options from <code>properties</code>. 095 * 096 * See {@link #doConfigure(String, LoggerRepository)} for the expected format. 097 * 098 * @param properties The properties 099 */ 100 public static void configure(final Properties properties) { 101 } 102 103 /** 104 * Like {@link #configureAndWatch(String, long)} except that the 105 * default delay as defined by FileWatchdog.DEFAULT_DELAY is 106 * used. 107 * 108 * @param configFilename A file in key=value format. 109 */ 110 public static void configureAndWatch(final String configFilename) { 111 } 112 113 /** 114 * Read the configuration file <code>configFilename</code> if it 115 * exists. Moreover, a thread will be created that will periodically 116 * check if <code>configFilename</code> has been created or 117 * modified. The period is determined by the <code>delay</code> 118 * argument. If a change or file creation is detected, then 119 * <code>configFilename</code> is read to configure log4j. 120 * 121 * @param configFilename A file in key=value format. 122 * @param delay The delay in milliseconds to wait between each check. 123 */ 124 public static void configureAndWatch(final String configFilename, final long delay) { 125 } 126}