org.apache.log4j.examples.appserver
Class AppServerPropConfigurator
java.lang.Object
|
+--org.apache.log4j.BasicConfigurator
|
+--org.apache.log4j.PropertyConfigurator
|
+--org.apache.log4j.examples.appserver.AppServerPropConfigurator
- All Implemented Interfaces:
- Configurator
- public class AppServerPropConfigurator
- extends PropertyConfigurator
Extends PropertyConfigurator
to configure AppServerCategoryFactory
instances according to property file entries. The important method is
configureCategoryFactory
. The static methods are
needed to override the static methods in PropertyConfigurator
that don't instanciate the desired instance (for
AppServerPropConfigurator
).
- Since:
- 1.1b6
- Author:
- Paul Glezen
Field Summary |
static String |
COMPONENT_NAME
The key for specifying the component name in a property file. |
static String |
MSGFILE_NAME
The key for specifying a message file containing externalized
message strings. |
static String |
SERVER_NAME
The key for specifying the server name in a propert file. |
static String |
VERSION_NAME
The key for specifying the version in a property file. |
Methods inherited from class org.apache.log4j.BasicConfigurator |
addRenderer, configure, configure, disable, disable, disableAll, disableDebug, disableInfo, enableAll, resetConfiguration, resetConfiguration |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SERVER_NAME
public static final String SERVER_NAME
- The key for specifying the server name in a propert file. The
current value is "
log4j.appserver.factory.server
".
COMPONENT_NAME
public static final String COMPONENT_NAME
- The key for specifying the component name in a property file. The
current value is "
log4j.appserver.factory.component
".
VERSION_NAME
public static final String VERSION_NAME
- The key for specifying the version in a property file. The current
value is "
log4j.appserver.factory.version
".
MSGFILE_NAME
public static final String MSGFILE_NAME
- The key for specifying a message file containing externalized
message strings. The contents are assigned to a
ResourceBundle
and assigned to each
AppServerCategory
instance that is created. The
current value is "log4j.appserver.factory.msgfile
".
Since the message file is loaded as a resource bundle using the
getBundle
method, the filename should end with
".properties
". However, the .properties
extension should not be included as part of the value
specified for this property. The getBundle
method
assumes this already.
AppServerPropConfigurator
public AppServerPropConfigurator()
configure
public static void configure(String configFilename)
- Read configuration from a file using the provided filename.
configure
public static void configure(URL configURL)
- Read configuration options from a URL.
configure
public static void configure(Properties props)
- Read configuration from a
Properties
object.
configureAndWatch
public static void configureAndWatch(String configFilename)
- Like
configureAndWatch(String, long)
except that the
default delay as defined by FileWatchdog.DEFAULT_DELAY
is
used.
- Parameters:
configFilename
- A file in key=value format.
configureAndWatch
public static void configureAndWatch(String configFilename,
long delay)
- Read the configuration file
configFilename
if it
exists. 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.
- Parameters:
configFilename
- A file in key=value format.delay
- The delay in milliseconds to wait between each check.
configureCategoryFactory
protected void configureCategoryFactory(Properties props)
- Configure an
AppServerCategoryFactory
instance for use as the category factory in further log4j configuration.
The property names used by this method are the following constants
defined by this class.
- Overrides:
configureCategoryFactory
in class PropertyConfigurator
- Parameters:
props
- Properties object used for log4j configuration
Please notify me about new log4j releases.