Package org.opends.server.loggers
Class ErrorLogger
java.lang.Object
org.opends.server.loggers.AbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,ErrorLogPublisherCfg>
org.opends.server.loggers.ErrorLogger
- All Implemented Interfaces:
ConfigurationAddListener<ErrorLogPublisherCfg>
,ConfigurationChangeListener<ErrorLogPublisherCfg>
,ConfigurationDeleteListener<ErrorLogPublisherCfg>
public final class ErrorLogger
extends AbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,ErrorLogPublisherCfg>
This class defines the wrapper that will invoke all registered error loggers for each type of request received or
response sent. If no error log publishers are registered, messages will be directed to standard out.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLogPublisher
(ErrorLogPublisher<ErrorLogPublisherCfg> publisher) Add a log publisher to the logger.void
Disables the server startup error logger.void
Enables console logging during server startup.static ErrorLogger
Retrieve the singleton instance of this class.protected ClassPropertyDefinition
Returns the javaClassPropertyDefinition
for the current logger.protected Collection<ErrorLogPublisher<ErrorLogPublisherCfg>>
Returns the log publishers.static boolean
Indicates if debug severity is enabled in at least one publisher.static boolean
isEnabledFor
(long categoryMask, Severity severity) Check if logging is enabled for the provided category and severity.static void
log
(String category, long categoryMask, Severity severity, LocalizableMessage message) Writes a message to the error log using the provided information.void
modifyLogPublisher
(ErrorLogPublisher<ErrorLogPublisherCfg> currentPublisher, ErrorLogPublisherCfg newConfig) Modify an existing log publisher.void
Removes all existing log publishers from the logger.void
removeLogPublisher
(ErrorLogPublisher<ErrorLogPublisherCfg> publisher) Remove a log publisher from the logger.Methods inherited from class org.opends.server.loggers.AbstractLogger
applyConfigurationAdd, applyConfigurationChange, applyConfigurationDelete, initializeLogger, isConfigurationAddAcceptable, isConfigurationChangeAcceptable, isConfigurationDeleteAcceptable
-
Method Details
-
getInstance
Retrieve the singleton instance of this class.- Returns:
- The singleton instance of this logger.
-
getJavaClassPropertyDefinition
Description copied from class:AbstractLogger
Returns the javaClassPropertyDefinition
for the current logger.- Specified by:
getJavaClassPropertyDefinition
in classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,
ErrorLogPublisherCfg> - Returns:
- the java
ClassPropertyDefinition
for the current logger.
-
getLogPublishers
Description copied from class:AbstractLogger
Returns the log publishers.- Specified by:
getLogPublishers
in classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,
ErrorLogPublisherCfg> - Returns:
- the collection of
LogPublisher
s
-
log
public static void log(String category, long categoryMask, Severity severity, LocalizableMessage message) Writes a message to the error log using the provided information.Category is defined using either short name (used for classes in well defined packages) or fully qualified classname. Conversion to short name is done automatically when loggers are created, see
LoggingCategoryNames
for list of existing short names.- Parameters:
category
- The category of the message, which is either a classname or a simple category name defined inLoggingCategoryNames
class.categoryMask
- The bitmask of the category.severity
- The severity of the message.message
- The message to be logged.
-
isEnabledFor
Check if logging is enabled for the provided category and severity.- Parameters:
categoryMask
- The bitmask of the category.severity
- The severity of logging event.- Returns:
true
if logger is enabled
-
hasDebugSeverity
public static boolean hasDebugSeverity()Indicates if debug severity is enabled in at least one publisher.This is an optimised check for debug level. It is kept separated from
isEnabledFor()
in order to avoid checking for non-debug levels.- Returns:
- True if debug severity is enabled in at least one publisher, False otherwise.
-
enableServerStartupLogger
Enables console logging during server startup.- Parameters:
out
- The output stream.
-
disableServerStartupLogger
public void disableServerStartupLogger()Disables the server startup error logger. -
addLogPublisher
Description copied from class:AbstractLogger
Add a log publisher to the logger.- Specified by:
addLogPublisher
in classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,
ErrorLogPublisherCfg> - Parameters:
publisher
- The log publisher to add.
-
modifyLogPublisher
public void modifyLogPublisher(ErrorLogPublisher<ErrorLogPublisherCfg> currentPublisher, ErrorLogPublisherCfg newConfig) throws ConfigException Description copied from class:AbstractLogger
Modify an existing log publisher.- Overrides:
modifyLogPublisher
in classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,
ErrorLogPublisherCfg> - Parameters:
currentPublisher
- The log publisher to modify.newConfig
- The new configuration.- Throws:
ConfigException
- If an error occurs.
-
removeLogPublisher
Description copied from class:AbstractLogger
Remove a log publisher from the logger.- Specified by:
removeLogPublisher
in classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,
ErrorLogPublisherCfg> - Parameters:
publisher
- The log publisher to remove.
-
removeAllLogPublishers
public void removeAllLogPublishers()Description copied from class:AbstractLogger
Removes all existing log publishers from the logger.- Specified by:
removeAllLogPublishers
in classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,
ErrorLogPublisherCfg>
-