|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sun.star.util.logging
Class LogManager
java.lang.Object | +--com.sun.star.util.logging.LogManager
- public class LogManager
- extends java.lang.Object
The LogManager is a Singleton and obtains/provides the properties that are used to configure the Loggers.
The LogManager object is created during class initialization and cannot subsequently be changed.
By default, the LogManager reads its initial configuration from a properties file "lib/logging.properties" in the JRE directory. If you edit that property file you can change the default logging configuration for all uses of that JRE. A watchdog is started that monitors logging.properties for changes. The interval is set in the same file with the property .watch. The value denotes the interval in ms.
Two optional system properties CAN be used that allow more control over reading the initial configuration:
- "java.util.logging.config.class"
- "java.util.logging.config.file"
If the "java.util.logging.config.class" property is set, then the property value is treated as a class name. The given class will be loaded, an object will be instantiated, and that object's constructor is responsible for reading in the initial configuration. (That object may use other system properties to control its configuration.)
If "java.util.logging.config.class" property is not set, then the "java.util.logging.config.file" system property can be used to specify a properties file (in java.util.Properties format). The initial logging configuration will be read from this file.
If neither of these properties is defined then, as described above, the LogManager will read its initial configuration from a properties file "lib/logging.properties" in the JRE directory.
The property "handlers" defines a whitespace separated list of class names for handler classes to load and register as global handlers. Each class name must be for a Handler class which has a default constructor. If you don't specify this, all loggers that are not specified will produce no output.
Note that all classes loaded during LogManager configuration must be on the system class path. That includes the LogManager class, any config classes, and any handler classes.
Loggers are organized into a naming hierarchy based on their dot separated names. Thus "a.b.c" is a child of "a.b", but "a.b1" and a.b2" are peers. Handlers are recongnized by their package/class name. Thus the properties for loggers and Handlers will have names starting with the dot-separated name for the handler or logger.
All properties whose names end with ".level" are assumed to define log levels for Loggers. Thus "foo.level" defines a log level for the logger called "foo" and (recursively) for any of its children in the naming hierarchy. The property name ".level" can be used to set the level for the root of the tree.
All properties whose names end with ".class" are assumed to define class files to be loaded for instanciation of Loggers. Thus "foo.class" defines a class for the logger called "foo" and (recursively) for any of its children in the naming hierarchy. The property name ".class" can be used to set the level for the root of the tree.
All properties whose names end with ".handler" are assumed to define handlers for loggers. Thus "foo.handler" defines a handler for the logger called "foo" and (recursively) for any of its children in the naming hierarchy. Use "handlers" to set global handlers.
All methods on the LogManager object are multi-thread safe.
Constructor Summary | |
protected |
LogManager()
|
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Clients can add their PropertyChangeListener here to get informed about changes in the configuration file. |
static LogManager |
getInstance()
Get singleton instance of LogManager. |
java.util.Properties |
getProperties()
Returns a copy of the private property hash. |
java.lang.String |
getProperty(java.lang.String sKey)
Get the property denoted by sKey. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a listener |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
LogManager
protected LogManager()
Method Detail |
getInstance
public static LogManager getInstance()
- Get singleton instance of LogManager.
getProperty
public java.lang.String getProperty(java.lang.String sKey)
- Get the property denoted by sKey.
- Parameters:
sKey
- key denoting the property- Returns:
- a suitable property
getProperties
public java.util.Properties getProperties()
- Returns a copy of the private property hash.
- Returns:
- property hash
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l) throws java.lang.SecurityException
- Clients can add their PropertyChangeListener here to get
informed about changes in the configuration file.
- Parameters:
PropertyChangeListener
- listener to be added
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l) throws java.lang.SecurityException
- Removes a listener
- Parameters:
PropertyChangeListener
- listener to be removed
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |