public class PropertyConfigurator extends Object implements Configurator
Modifier and Type | Field and Description |
---|---|
static String |
LOGGER_FACTORY_KEY
Key for specifying the
LoggerFactory . |
protected LoggerFactory |
loggerFactory |
protected Hashtable |
registry
Used internally to keep track of configured appenders.
|
INHERITED, NULL
Constructor and Description |
---|
PropertyConfigurator() |
Modifier and Type | Method and Description |
---|---|
static void |
configure(InputStream inputStream)
Reads configuration options from an InputStream.
|
static void |
configure(Properties properties)
Reads configuration options from
properties . |
static void |
configure(String fileName)
Reads configuration options from configuration file.
|
static void |
configure(URL configURL)
Reads configuration options from url
configURL . |
static void |
configureAndWatch(String configFilename)
Like
configureAndWatch(String, long) except that the default delay as defined by FileWatchdog.DEFAULT_DELAY
is used. |
static void |
configureAndWatch(String configFilename,
long delayMillis)
Reads the configuration file
configFilename if it exists. |
protected void |
configureLoggerFactory(Properties properties)
|
void |
doConfigure(InputStream inputStream,
LoggerRepository loggerRepository)
Reads configuration options from an InputStream.
|
void |
doConfigure(Properties properties,
LoggerRepository loggerRepository)
Reads configuration options from
properties . |
void |
doConfigure(String fileName,
LoggerRepository loggerRepository)
Reads configuration options from configuration file.
|
void |
doConfigure(URL url,
LoggerRepository loggerRepository)
Read configuration options from url
configURL . |
protected void |
parseCatsAndRenderers(Properties properties,
LoggerRepository loggerRepository)
Parse non-root elements, such non-root categories and renderers.
|
public static final String LOGGER_FACTORY_KEY
LoggerFactory
. Currently set to
"log4j.loggerFactory
".protected Hashtable registry
protected LoggerFactory loggerFactory
public static void configure(InputStream inputStream)
inputStream
- The input streampublic static void configure(Properties properties)
properties
.
See doConfigure(String, LoggerRepository)
for the expected format.properties
- The propertiespublic static void configure(String fileName)
fileName
- The configuration file.public static void configure(URL configURL)
configURL
.configURL
- The configuration URLpublic static void configureAndWatch(String configFilename)
configureAndWatch(String, long)
except that the default delay as defined by FileWatchdog.DEFAULT_DELAY
is used.configFilename
- A file in key=value format.public static void configureAndWatch(String configFilename, long delayMillis)
configFilename
if it exists. Moreover, a thread will be created that will
periodically check if configFilename
has been created or modified. The period is determined by the
delay
argument. If a change or file creation is detected, then configFilename
is read to
configure log4j.configFilename
- A file in key=value format.delayMillis
- The delay in milliseconds to wait between each check.protected void configureLoggerFactory(Properties properties)
Properties
object for a LoggerFactory
entry specified by LOGGER_FACTORY_KEY
. If such an entry exists, an attempt is made to create an instance
using the default constructor. This instance is used for subsequent Category creations within this configurator.public void doConfigure(InputStream inputStream, LoggerRepository loggerRepository)
doConfigure
in interface Configurator
inputStream
- The input streamloggerRepository
- The hierarchypublic void doConfigure(Properties properties, LoggerRepository loggerRepository)
properties
.
See doConfigure(String, LoggerRepository)
for the expected format.properties
- The propertiesloggerRepository
- The hierarchypublic void doConfigure(String fileName, LoggerRepository loggerRepository)
fileName
- The configuration fileloggerRepository
- The hierarchypublic void doConfigure(URL url, LoggerRepository loggerRepository)
configURL
.doConfigure
in interface Configurator
url
- The configuration URLloggerRepository
- The hierarchyprotected void parseCatsAndRenderers(Properties properties, LoggerRepository loggerRepository)
Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.