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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLogPublisher(ErrorLogPublisher<ErrorLogPublisherCfg> publisher)
Add a log publisher to the logger.void
disableServerStartupLogger()
Disables the server startup error logger.void
enableServerStartupLogger(PrintStream out)
Enables console logging during server startup.static ErrorLogger
getInstance()
Retrieve the singleton instance of this class.protected ClassPropertyDefinition
getJavaClassPropertyDefinition()
Returns the javaClassPropertyDefinition
for the current logger.protected Collection<ErrorLogPublisher<ErrorLogPublisherCfg>>
getLogPublishers()
Returns the log publishers.static boolean
isEnabledFor(String category, Severity severity)
Check if logging is enabled for the provided category and severity.static void
log(String category, Severity severity, LocalizableMessage message, Throwable exception)
Writes a message to the error log using the provided information.void
removeAllLogPublishers()
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 Detail
-
getInstance
public static ErrorLogger getInstance()
Retrieve the singleton instance of this class.- Returns:
- The singleton instance of this logger.
-
getJavaClassPropertyDefinition
protected ClassPropertyDefinition 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
protected Collection<ErrorLogPublisher<ErrorLogPublisherCfg>> 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, Severity severity, LocalizableMessage message, Throwable exception)
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.severity
- The severity of the message.message
- The message to be logged.exception
- The exception to be logged. May benull
.
-
isEnabledFor
public static boolean isEnabledFor(String category, Severity severity)
Check if logging is enabled for the provided category and severity.- Parameters:
category
- The category of the logging event, which is either a classname or a simple category name defined inLoggingCategoryNames
class.severity
- The severity of logging event.- Returns:
true
if logger is enabled
-
enableServerStartupLogger
public void enableServerStartupLogger(PrintStream out)
Enables console logging during server startup.- Parameters:
out
- The output stream.
-
disableServerStartupLogger
public void disableServerStartupLogger()
Disables the server startup error logger.
-
addLogPublisher
public void addLogPublisher(ErrorLogPublisher<ErrorLogPublisherCfg> publisher)
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.
-
removeLogPublisher
public void removeLogPublisher(ErrorLogPublisher<ErrorLogPublisherCfg> publisher)
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>
-
-