| |
|
| java.lang.Object com.sun.jbi.framework.ComponentLogger
ComponentLogger | public class ComponentLogger implements ComponentLoggerMBean(Code) | | This class implements the ComponentLoggerMBean for a Component (BC or SE).
This MBean acts as an agent between the JMX management service and the
UI runtime to provide operations for displaying and modifying the logger
levels for a component.
author: Sun Microsystems, Inc. |
Field Summary | |
final static String | CONFIG_DIRECTORY The name of the directory where the component logger level properties
file is written. | final static String | DISPLAY_NAME The suffix for the logger display name property stored in the logger
properties file. | final static String | LOGGER_DEFAULT The value for a component logger level property for inheriting from the
parent logger. | final static String | LOGGER_SETTINGS The name of the file containing the component logger level properties. |
Method Summary | |
boolean | addLogger(Logger logger, String displayName) Add an entry to the logger info table. | void | addLoggerInfo(String loggerName, String displayName, boolean addPrefix) Add predefined logger information to the logger info table. | public String | getDisplayName(String logName) Get the localized display name of the specified logger. | public String | getLevel(String logName) Get the log level of the specified logger. | String | getLoggerNamePrefix() Get the logger name prefix for this component. | public String[] | getLoggerNames() Get the names of all loggers controlled by this MBean. | Level | getSavedLevel(String loggerName) Get the saved logger level for a logger. | boolean | isLoggerRegistered(String name) Return an indication of whether or not a logger is registered. | void | loadLoggerSettings() Load logger level setting properties from the persisted file. | synchronized void | saveLoggerSettings() Save logger level setting properties to a persisted file. | public int | setAll(String logName) Set the log level of the specified logger to ALL.
Parameters: logName - the logger name. | public int | setConfig(String logName) Set the log level of the specified logger to CONFIG.
Parameters: logName - the logger name. | public int | setDefault(String logName) Set the log level of the specified logger to the default, which is
null to inherit the parent logger's level.
Parameters: logName - the logger name. | public int | setFine(String logName) Set the log level of the specified logger to FINE.
Parameters: logName - the logger name. | public int | setFiner(String logName) Set the log level of the specified logger to FINER.
Parameters: logName - the logger name. | public int | setFinest(String logName) Set the log level of the specified logger to FINEST.
Parameters: logName - the logger name. | public int | setInfo(String logName) Set the log level of the specified logger to INFO.
Parameters: logName - the logger name. | int | setLevel(String logName, Level logLevel) Set the log level of the specified logger to the specified level. | void | setLoggerNamePrefix(String prefix) Set the logger name prefix for this component. | public int | setOff(String logName) Set the log level of the specified logger to OFF.
Parameters: logName - the logger name. | public int | setSevere(String logName) Set the log level of the specified logger to SEVERE.
Parameters: logName - the logger name. | public int | setWarning(String logName) Set the log level of the specified logger to WARNING.
Parameters: logName - the logger name. |
CONFIG_DIRECTORY | final static String CONFIG_DIRECTORY(Code) | | The name of the directory where the component logger level properties
file is written. NOTE: This package-accessible to allow the unit test
to use it.
|
DISPLAY_NAME | final static String DISPLAY_NAME(Code) | | The suffix for the logger display name property stored in the logger
properties file. NOTE: This package-accessible to allow the unit test
to use it.
|
LOGGER_DEFAULT | final static String LOGGER_DEFAULT(Code) | | The value for a component logger level property for inheriting from the
parent logger. NOTE: This package-accessible to allow the unit test
to use it.
|
LOGGER_SETTINGS | final static String LOGGER_SETTINGS(Code) | | The name of the file containing the component logger level properties.
NOTE: This package-accessible to allow the unit test to use it.
|
ComponentLogger | ComponentLogger(Component component)(Code) | | Constructor. This loads any logger levels that were previously persisted,
and creates the top-level logger for the component, setting its parent
to the top-level JBI logger and its level to the persisted level if
found.
Parameters: component - is the Component instance for this component. |
addLogger | boolean addLogger(Logger logger, String displayName)(Code) | | Add an entry to the logger info table. Each entry contains the logger
name as the key and the LoggerInfo instance as the value. If an entry
already exists for this logger name, but its logger reference has not
been set, set it now. Do the same for the display name.
Parameters: logger - The Logger instance. Parameters: displayName - The logger's display name. true if either the logger instance was not alreadyset in the existing LoggerInfo, or there was no existing LoggerInfo forthis logger. Returns false if there was an existingLoggerInfo and its logger instance was already set. Note that the returnvalue is used only for unit testing. |
addLoggerInfo | void addLoggerInfo(String loggerName, String displayName, boolean addPrefix)(Code) | | Add predefined logger information to the logger info table. This creates
a new LoggerInfo object using the provided values, and adds it to the
logger info table. It also adds a property for the logger to the logger
settings, with the value set to the default logger level. The logger
reference is not set, as the logger has not yet been created.
Note that this method is called only during installation or upgrade of
a component.
Parameters: loggerName - the name of the logger to be added. Parameters: displayName - the display name of the logger to be added; if thisis null the last level of the logger name is used. Parameters: addPrefix - set to true if the prefix should be addedto this logger name, or false if the logger name shouldbe kept as is. |
getDisplayName | public String getDisplayName(String logName)(Code) | | Get the localized display name of the specified logger. If none is
available, return a default name set to the last level of the logger
name.
Parameters: logName - the name of the logger. String representing the localized display name. |
getLevel | public String getLevel(String logName) throws javax.jbi.JBIException(Code) | | Get the log level of the specified logger. If the level is not set,
search the parent logger chain until a logger is found with a level set.
In the case where this method is called before the component has been
started, the logger may not exist. In this case, retrieve the logger
level property and use its value, or if there is no logger level property
set, use the top-level component logger's level. The top-level component
logger always exists because it is created by the constructor of this
class.
Parameters: logName - the name of the logger. String representing log level or null if no level is available. throws: javax.jbi.JBIException - if the logger is not known. |
getLoggerNamePrefix | String getLoggerNamePrefix()(Code) | | Get the logger name prefix for this component.
the logger name prefix. |
getLoggerNames | public String[] getLoggerNames()(Code) | | Get the names of all loggers controlled by this MBean.
an array of logger names as String objects. |
getSavedLevel | Level getSavedLevel(String loggerName)(Code) | | Get the saved logger level for a logger. This is used for restoring
persisted logger levels that were set explicitly.
Parameters: loggerName - The logger name. The logger level, or null if none was persisted. |
isLoggerRegistered | boolean isLoggerRegistered(String name)(Code) | | Return an indication of whether or not a logger is registered.
true if the logger is registered, orfalse if not. |
loadLoggerSettings | void loadLoggerSettings()(Code) | | Load logger level setting properties from the persisted file.
|
saveLoggerSettings | synchronized void saveLoggerSettings()(Code) | | Save logger level setting properties to a persisted file.
|
setDefault | public int setDefault(String logName) throws javax.jbi.JBIException(Code) | | Set the log level of the specified logger to the default, which is
null to inherit the parent logger's level.
Parameters: logName - the logger name. 0 if operation is successful. throws: javax.jbi.JBIException - if the logger is not found. |
setLevel | int setLevel(String logName, Level logLevel) throws javax.jbi.JBIException(Code) | | Set the log level of the specified logger to the specified level. This
also persists the logger settings for the component so that if a restart
occurs, the logger settings are retained.
Parameters: logName - the logger name. Parameters: logLevel - the log level. 0 if operation is successful. throws: javax.jbi.JBIException - if the logger is not found. |
setLoggerNamePrefix | void setLoggerNamePrefix(String prefix)(Code) | | Set the logger name prefix for this component.
Parameters: prefix - the logger name prefix to be set. |
|
|
|