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 voidaddLogPublisher(ErrorLogPublisher<ErrorLogPublisherCfg> publisher)Add a log publisher to the logger.voiddisableServerStartupLogger()Disables the server startup error logger.voidenableServerStartupLogger(PrintStream out)Enables console logging during server startup.static ErrorLoggergetInstance()Retrieve the singleton instance of this class.protected ClassPropertyDefinitiongetJavaClassPropertyDefinition()Returns the javaClassPropertyDefinitionfor the current logger.protected Collection<ErrorLogPublisher<ErrorLogPublisherCfg>>getLogPublishers()Returns the log publishers.static booleanisEnabledFor(String category, Severity severity)Check if logging is enabled for the provided category and severity.static voidlog(String category, Severity severity, LocalizableMessage message, Throwable exception)Writes a message to the error log using the provided information.voidremoveAllLogPublishers()Removes all existing log publishers from the logger.voidremoveLogPublisher(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:AbstractLoggerReturns the javaClassPropertyDefinitionfor the current logger.- Specified by:
getJavaClassPropertyDefinitionin classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,ErrorLogPublisherCfg>- Returns:
- the java
ClassPropertyDefinitionfor the current logger.
-
getLogPublishers
protected Collection<ErrorLogPublisher<ErrorLogPublisherCfg>> getLogPublishers()
Description copied from class:AbstractLoggerReturns the log publishers.- Specified by:
getLogPublishersin classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,ErrorLogPublisherCfg>- Returns:
- the collection of
LogPublishers
-
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
LoggingCategoryNamesfor list of existing short names.- Parameters:
category- The category of the message, which is either a classname or a simple category name defined inLoggingCategoryNamesclass.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 inLoggingCategoryNamesclass.severity- The severity of logging event.- Returns:
trueif 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:AbstractLoggerAdd a log publisher to the logger.- Specified by:
addLogPublisherin classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,ErrorLogPublisherCfg>- Parameters:
publisher- The log publisher to add.
-
removeLogPublisher
public void removeLogPublisher(ErrorLogPublisher<ErrorLogPublisherCfg> publisher)
Description copied from class:AbstractLoggerRemove a log publisher from the logger.- Specified by:
removeLogPublisherin classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,ErrorLogPublisherCfg>- Parameters:
publisher- The log publisher to remove.
-
removeAllLogPublishers
public void removeAllLogPublishers()
Description copied from class:AbstractLoggerRemoves all existing log publishers from the logger.- Specified by:
removeAllLogPublishersin classAbstractLogger<ErrorLogPublisher<ErrorLogPublisherCfg>,ErrorLogPublisherCfg>
-
-