org.opends.server.loggers.debug
Class DebugLogger

java.lang.Object
  extended by org.opends.server.loggers.debug.DebugLogger
All Implemented Interfaces:
ConfigurationAddListener<DebugLogPublisherCfg>, ConfigurationChangeListener<DebugLogPublisherCfg>, ConfigurationDeleteListener<DebugLogPublisherCfg>

public class DebugLogger
extends java.lang.Object
implements ConfigurationAddListener<DebugLogPublisherCfg>, ConfigurationDeleteListener<DebugLogPublisherCfg>, ConfigurationChangeListener<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.


Nested Class Summary
static interface DebugLogger.NoDebugTracing
          Classes and methods annotated with @NoDebugTracing will not be weaved with debug logging statements by AspectJ.
static interface DebugLogger.NoEntryDebugTracing
          Methods annotated with @NoEntryDebugTracing will not be weaved with entry debug logging statements by AspectJ.
static interface DebugLogger.NoExitDebugTracing
          Methods annotated with @NoExitDebugTracing will not be weaved with exit debug logging statements by AspectJ.
static interface DebugLogger.TraceThrown
          Methods annotated with @TraceThrown will be weaved by AspectJ with debug logging statements when an exception is thrown from the method.
 
Constructor Summary
DebugLogger()
           
 
Method Summary
static void addDebugLogPublisher(DebugLogPublisher publisher)
          Add an debug log publisher to the debug logger.
 ConfigChangeResult applyConfigurationAdd(DebugLogPublisherCfg config)
          Adds a new configuration to this add listener.
 ConfigChangeResult applyConfigurationChange(DebugLogPublisherCfg config)
          Applies the configuration changes to this change listener.
 ConfigChangeResult applyConfigurationDelete(DebugLogPublisherCfg config)
          Deletes an existing configuration from this delete listener.
static boolean debugEnabled()
          Indicates if debug logging is enabled.
static DebugLogger getInstance()
          Retrieve the singleton instance of this class.
static DebugTracer getTracer()
          Creates a new Debug Tracer for the caller class and registers it with the Debug Logger.
static DebugTracer getTracer(java.lang.String className)
          Returns the registered Debug Tracer for a traced class.
 void initializeDebugLogger(java.util.List<DebugLogPublisherCfg> configs)
          Initializes all the debug log publishers.
 boolean isConfigurationAddAcceptable(DebugLogPublisherCfg config, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed addition of a new configuration is acceptable to this add listener.
 boolean isConfigurationChangeAcceptable(DebugLogPublisherCfg config, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 boolean isConfigurationDeleteAcceptable(DebugLogPublisherCfg config, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.
static void removeAllDebugLogPublishers()
          Removes all existing debug log publishers from the logger.
static boolean removeDebugLogPublisher(DebugLogPublisher publisher)
          Remove an debug log publisher from the debug logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebugLogger

public DebugLogger()
Method Detail

addDebugLogPublisher

public static void addDebugLogPublisher(DebugLogPublisher publisher)
Add an debug log publisher to the debug logger.

Parameters:
publisher - The error log publisher to add.

removeDebugLogPublisher

public static boolean removeDebugLogPublisher(DebugLogPublisher publisher)
Remove an debug log publisher from the debug logger.

Parameters:
publisher - The debug log publisher to remove.
Returns:
The publisher that was removed or null if it was not found.

removeAllDebugLogPublishers

public static void removeAllDebugLogPublishers()
Removes all existing debug log publishers from the logger.


initializeDebugLogger

public void initializeDebugLogger(java.util.List<DebugLogPublisherCfg> configs)
                           throws ConfigException,
                                  InitializationException
Initializes all the debug log publishers.

Parameters:
configs - The debug log publisher configurations.
Throws:
ConfigException - If an unrecoverable problem arises in the process of performing the initialization as a result of the server configuration.
InitializationException - If a problem occurs during initialization that is not related to the server configuration.

isConfigurationAddAcceptable

public boolean isConfigurationAddAcceptable(DebugLogPublisherCfg config,
                                            java.util.List<Message> unacceptableReasons)
Indicates whether the proposed addition of a new configuration is acceptable to this add listener.

Specified by:
isConfigurationAddAcceptable in interface ConfigurationAddListener<DebugLogPublisherCfg>
Parameters:
config - The configuration that will be added.
unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
Returns:
Returns true if the proposed addition is acceptable, or false if it is not.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(DebugLogPublisherCfg config,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.

Specified by:
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<DebugLogPublisherCfg>
Parameters:
config - The new configuration containing the changes.
unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
Returns:
Returns true if the proposed change is acceptable, or false if it is not.

applyConfigurationAdd

public ConfigChangeResult applyConfigurationAdd(DebugLogPublisherCfg config)
Adds a new configuration to this add listener.

Specified by:
applyConfigurationAdd in interface ConfigurationAddListener<DebugLogPublisherCfg>
Parameters:
config - The configuration that will be added.
Returns:
Returns information about the result of adding the configuration.

applyConfigurationChange

public ConfigChangeResult applyConfigurationChange(DebugLogPublisherCfg config)
Applies the configuration changes to this change listener.

Specified by:
applyConfigurationChange in interface ConfigurationChangeListener<DebugLogPublisherCfg>
Parameters:
config - The new configuration containing the changes.
Returns:
Returns information about the result of changing the configuration.

isConfigurationDeleteAcceptable

public boolean isConfigurationDeleteAcceptable(DebugLogPublisherCfg config,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.

Specified by:
isConfigurationDeleteAcceptable in interface ConfigurationDeleteListener<DebugLogPublisherCfg>
Parameters:
config - The configuration that will be deleted.
unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
Returns:
Returns true if the proposed deletion is acceptable, or false if it is not.

applyConfigurationDelete

public ConfigChangeResult applyConfigurationDelete(DebugLogPublisherCfg config)
Deletes an existing configuration from this delete listener.

Specified by:
applyConfigurationDelete in interface ConfigurationDeleteListener<DebugLogPublisherCfg>
Parameters:
config - The existing configuration that will be deleted.
Returns:
Returns information about the result of deleting the configuration.

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()
Creates a new Debug Tracer for the caller class and registers it with the Debug Logger.

Returns:
The tracer created for the caller class.

getTracer

public static DebugTracer getTracer(java.lang.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.