Package org.opends.server.loggers
Class DebugLogger
- java.lang.Object
-
- org.opends.server.loggers.AbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>
-
- org.opends.server.loggers.DebugLogger
-
- All Implemented Interfaces:
ConfigurationAddListener<DebugLogPublisherCfg>,ConfigurationChangeListener<DebugLogPublisherCfg>,ConfigurationDeleteListener<DebugLogPublisherCfg>
public final class DebugLogger extends AbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>
A logger for debug and trace logging. DebugLogger provides a debugging management access point. It is used to configure the Tracers, as well as to register a per-class tracer. Various stub debug methods are provided to log different types of debug messages. However, these methods do not contain any actual implementation. Tracer aspects are later weaved to catch alls to these stub methods and do the work of logging the message. DebugLogger is self-initializing.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLogPublisher(DebugLogPublisher<DebugLogPublisherCfg> publisher)Add a log publisher to the logger.TextDebugLogPublisheraddPublisherIfRequired(TextWriter writer)Adds a text debug log publisher that will print all messages to the provided writer, based on debug target(s) defined through system properties.static booleandebugEnabled()Indicates if debug logging is enabled.voiddisableServerStartupLogger()Disables the server startup debug logger.voidenableServerStartupLogger(PrintStream out)Enables console logging during server startup if debugging has been enabled.static DebugLoggergetInstance()Retrieve the singleton instance of this class.protected ClassPropertyDefinitiongetJavaClassPropertyDefinition()Returns the javaClassPropertyDefinitionfor the current logger.protected Collection<DebugLogPublisher<DebugLogPublisherCfg>>getLogPublishers()Returns the log publishers.static DebugTracergetTracer(String className)Returns the registered Debug Tracer for a traced class.booleanisEnabled()Returns whether there is at least one debug log publisher enabled.voidremoveAllLogPublishers()Removes all existing log publishers from the logger.voidremoveLogPublisher(DebugLogPublisher<DebugLogPublisherCfg> 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
-
getJavaClassPropertyDefinition
protected ClassPropertyDefinition getJavaClassPropertyDefinition()
Description copied from class:AbstractLoggerReturns the javaClassPropertyDefinitionfor the current logger.- Specified by:
getJavaClassPropertyDefinitionin classAbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>- Returns:
- the java
ClassPropertyDefinitionfor the current logger.
-
getLogPublishers
protected Collection<DebugLogPublisher<DebugLogPublisherCfg>> getLogPublishers()
Description copied from class:AbstractLoggerReturns the log publishers.- Specified by:
getLogPublishersin classAbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>- Returns:
- the collection of
LogPublishers
-
debugEnabled
public static boolean debugEnabled()
Indicates if debug logging is enabled.- Returns:
- True if debug logging is enabled. False otherwise.
-
getInstance
public static DebugLogger getInstance()
Retrieve the singleton instance of this class.- Returns:
- The singleton instance of this logger.
-
getTracer
public static DebugTracer getTracer(String className)
Returns the registered Debug Tracer for a traced class.- Parameters:
className- The name of the class tracer to retrieve.- Returns:
- The tracer for the provided class or null if there are no tracers registered.
-
enableServerStartupLogger
public void enableServerStartupLogger(PrintStream out)
Enables console logging during server startup if debugging has been enabled.- Parameters:
out- The output stream.
-
disableServerStartupLogger
public void disableServerStartupLogger()
Disables the server startup debug logger.
-
addPublisherIfRequired
public TextDebugLogPublisher addPublisherIfRequired(TextWriter writer)
Adds a text debug log publisher that will print all messages to the provided writer, based on debug target(s) defined through system properties.It is expected that one or more system properties beginning with
PROPERTY_DEBUG_TARGETare set to define the properties of the debug targets used by the publisher, otherwise no publisher is added.- Parameters:
writer- The text writer where the message will be written to.- Returns:
- the publisher. It may be
nullif no publisher is added.
-
addLogPublisher
public void addLogPublisher(DebugLogPublisher<DebugLogPublisherCfg> publisher)
Description copied from class:AbstractLoggerAdd a log publisher to the logger.- Specified by:
addLogPublisherin classAbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>- Parameters:
publisher- The log publisher to add.
-
removeLogPublisher
public void removeLogPublisher(DebugLogPublisher<DebugLogPublisherCfg> publisher)
Description copied from class:AbstractLoggerRemove a log publisher from the logger.- Specified by:
removeLogPublisherin classAbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>- 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<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>
-
isEnabled
public boolean isEnabled()
Returns whether there is at least one debug log publisher enabled.- Returns:
- whether there is at least one debug log publisher enabled.
-
-