Package org.opends.server.loggers
Class DebugLogPublisher<T extends DebugLogPublisherCfg>
- java.lang.Object
-
- org.opends.server.loggers.DebugLogPublisher<T>
-
- Type Parameters:
T- The type of debug log publisher configuration handled by this log publisher implementation.
- All Implemented Interfaces:
Closeable,AutoCloseable,LogPublisher<T>
- Direct Known Subclasses:
ConsoleDebugLogPublisher,TextDebugLogPublisher
@PublicAPI(stability=VOLATILE, mayInstantiate=false, mayExtend=true, mayInvoke=false) public abstract class DebugLogPublisher<T extends DebugLogPublisherCfg> extends Object implements LogPublisher<T>
This class defines the set of methods and structures that must be implemented for a Directory Server debug log publisher.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDebugLogPublisher()Construct a default configuration where the global scope will only log at the ERROR level.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddTraceSettings(String scope, TraceSettings settings)Adds a trace settings to the current set for a specified scope.booleanisConfigurationAcceptable(T configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the provided configuration is acceptable for this log publisher.abstract voidtrace(TraceSettings settings, String signature, String sourceLocation, String msg, StackTraceElement[] stackTrace)Log an arbitrary event in a method.abstract voidtraceException(TraceSettings settings, String signature, String sourceLocation, String msg, Throwable ex, StackTraceElement[] stackTrace)Log a caught exception in a method.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opends.server.loggers.LogPublisher
close, getDN, initializeLogPublisher
-
-
-
-
Method Detail
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(T configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)
Description copied from interface:LogPublisherIndicates whether the provided configuration is acceptable for this log publisher. It should be possible to call this method on an uninitialized log publisher instance in order to determine whether the log publisher would be able to use the provided configuration.
Note that implementations which use a subclass of the provided configuration class will likely need to cast the configuration to the appropriate subclass type.- Specified by:
isConfigurationAcceptablein interfaceLogPublisher<T extends DebugLogPublisherCfg>- Parameters:
configuration- The log publisher configuration for which to make the determination.unacceptableReasons- A list that may be used to hold the reasons that the provided configuration is not acceptable.- Returns:
trueif the provided configuration is acceptable for this log publisher, orfalseif not.
-
addTraceSettings
public final void addTraceSettings(String scope, TraceSettings settings)
Adds a trace settings to the current set for a specified scope. If a scope is not specified, the settings will be set for the global scope. The global scope settings are used when no other scope matches.- Parameters:
scope- The scope for which to set the trace settings. This should be a fully-qualified class name, ornullto set the trace settings for the global scope.settings- The trace settings for the specified scope. Must not benull.- Throws:
NullPointerException- Ifsettingsisnull: the trace settings are held in concurrent maps, which do not accept null values.
-
trace
public abstract void trace(TraceSettings settings, String signature, String sourceLocation, String msg, StackTraceElement[] stackTrace)
Log an arbitrary event in a method.- Parameters:
settings- The current trace settings in effect.signature- The method signature.sourceLocation- The location of the method in the source.msg- The message to be logged.stackTrace- The stack trace at the time the message is logged or null if its not available.
-
traceException
public abstract void traceException(TraceSettings settings, String signature, String sourceLocation, String msg, Throwable ex, StackTraceElement[] stackTrace)
Log a caught exception in a method.- Parameters:
settings- The current trace settings in effect.signature- The method signature.sourceLocation- The location of the method in the source.msg- The message to be logged.ex- The exception that was caught.stackTrace- The stack trace at the time the exception is caught or null if its not available.
-
-