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 void
addLogPublisher(DebugLogPublisher<DebugLogPublisherCfg> publisher)
Add a log publisher to the logger.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.static boolean
debugEnabled()
Indicates if debug logging is enabled.void
disableServerStartupLogger()
Disables the server startup debug logger.void
enableServerStartupLogger(PrintStream out)
Enables console logging during server startup if debugging has been enabled.static DebugLogger
getInstance()
Retrieve the singleton instance of this class.protected ClassPropertyDefinition
getJavaClassPropertyDefinition()
Returns the javaClassPropertyDefinition
for the current logger.protected Collection<DebugLogPublisher<DebugLogPublisherCfg>>
getLogPublishers()
Returns the log publishers.static DebugTracer
getTracer(String className)
Returns the registered Debug Tracer for a traced class.boolean
isEnabled()
Returns whether there is at least one debug log publisher enabled.void
removeAllLogPublishers()
Removes all existing log publishers from the logger.void
removeLogPublisher(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:AbstractLogger
Returns the javaClassPropertyDefinition
for the current logger.- Specified by:
getJavaClassPropertyDefinition
in classAbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>
- Returns:
- the java
ClassPropertyDefinition
for the current logger.
-
getLogPublishers
protected Collection<DebugLogPublisher<DebugLogPublisherCfg>> getLogPublishers()
Description copied from class:AbstractLogger
Returns the log publishers.- Specified by:
getLogPublishers
in classAbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>
- Returns:
- the collection of
LogPublisher
s
-
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_TARGET
are 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
null
if no publisher is added.
-
addLogPublisher
public void addLogPublisher(DebugLogPublisher<DebugLogPublisherCfg> publisher)
Description copied from class:AbstractLogger
Add a log publisher to the logger.- Specified by:
addLogPublisher
in classAbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>
- Parameters:
publisher
- The log publisher to add.
-
removeLogPublisher
public void removeLogPublisher(DebugLogPublisher<DebugLogPublisherCfg> publisher)
Description copied from class:AbstractLogger
Remove a log publisher from the logger.- Specified by:
removeLogPublisher
in classAbstractLogger<DebugLogPublisher<DebugLogPublisherCfg>,DebugLogPublisherCfg>
- 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<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.
-
-