Package org.apache.log4j
Class PropertyConfigurator
java.lang.Object
org.apache.log4j.PropertyConfigurator
- All Implemented Interfaces:
Configurator
Configures Log4j from properties.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKey for specifying theLoggerFactory.protected LoggerFactoryprotected HashtableUsed internally to keep track of configured appenders.Fields inherited from interface org.apache.log4j.spi.Configurator
INHERITED, NULL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigure(InputStream inputStream) Reads configuration options from an InputStream.static voidReads configuration options from configuration file.static voidReads configuration options from urlconfigURL.static voidconfigure(Properties properties) Reads configuration options fromproperties.static voidconfigureAndWatch(String configFilename) LikeconfigureAndWatch(String, long)except that the default delay as defined by FileWatchdog.DEFAULT_DELAY is used.static voidconfigureAndWatch(String configFilename, long delayMillis) Reads the configuration fileconfigFilenameif it exists.protected voidconfigureLoggerFactory(Properties properties) voiddoConfigure(InputStream inputStream, LoggerRepository loggerRepository) Reads configuration options from an InputStream.voiddoConfigure(String fileName, LoggerRepository loggerRepository) Reads configuration options from configuration file.voiddoConfigure(URL url, LoggerRepository loggerRepository) Read configuration options from urlconfigURL.voiddoConfigure(Properties properties, LoggerRepository loggerRepository) Reads configuration options fromproperties.protected voidparseCatsAndRenderers(Properties properties, LoggerRepository loggerRepository) Parse non-root elements, such non-root categories and renderers.
-
Field Details
-
LOGGER_FACTORY_KEY
Key for specifying theLoggerFactory. Currently set to "log4j.loggerFactory".- See Also:
-
registry
Used internally to keep track of configured appenders. -
loggerFactory
-
-
Constructor Details
-
PropertyConfigurator
public PropertyConfigurator()
-
-
Method Details
-
configure
Reads configuration options from an InputStream.- Parameters:
inputStream- The input stream
-
configure
Reads configuration options fromproperties. SeedoConfigure(String, LoggerRepository)for the expected format.- Parameters:
properties- The properties
-
configure
Reads configuration options from configuration file.- Parameters:
fileName- The configuration file.
-
configure
Reads configuration options from urlconfigURL.- Parameters:
configURL- The configuration URL
-
configureAndWatch
LikeconfigureAndWatch(String, long)except that the default delay as defined by FileWatchdog.DEFAULT_DELAY is used.- Parameters:
configFilename- A file in key=value format.
-
configureAndWatch
Reads the configuration fileconfigFilenameif it exists. Moreover, a thread will be created that will periodically check ifconfigFilenamehas been created or modified. The period is determined by thedelayargument. If a change or file creation is detected, thenconfigFilenameis read to configure log4j.- Parameters:
configFilename- A file in key=value format.delayMillis- The delay in milliseconds to wait between each check.
-
configureLoggerFactory
Checks the providedPropertiesobject for aLoggerFactoryentry specified byLOGGER_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.- See Also:
-
doConfigure
Reads configuration options from an InputStream.- Specified by:
doConfigurein interfaceConfigurator- Parameters:
inputStream- The input streamloggerRepository- The hierarchy
-
doConfigure
Reads configuration options fromproperties. SeedoConfigure(String, LoggerRepository)for the expected format.- Parameters:
properties- The propertiesloggerRepository- The hierarchy
-
doConfigure
Reads configuration options from configuration file.- Parameters:
fileName- The configuration fileloggerRepository- The hierarchy
-
doConfigure
Read configuration options from urlconfigURL.- Specified by:
doConfigurein interfaceConfigurator- Parameters:
url- The configuration URLloggerRepository- The hierarchy
-
parseCatsAndRenderers
Parse non-root elements, such non-root categories and renderers.
-