Package org.opends.server.loggers
Class TextDebugLogPublisher
- java.lang.Object
-
- org.opends.server.loggers.DebugLogPublisher<FileBasedDebugLogPublisherCfg>
-
- org.opends.server.loggers.TextDebugLogPublisher
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConfigurationAddListener<DebugTargetCfg>
,ConfigurationChangeListener<FileBasedDebugLogPublisherCfg>
,ConfigurationDeleteListener<DebugTargetCfg>
,LogPublisher<FileBasedDebugLogPublisherCfg>
public final class TextDebugLogPublisher extends DebugLogPublisher<FileBasedDebugLogPublisherCfg> implements ConfigurationChangeListener<FileBasedDebugLogPublisherCfg>, ConfigurationAddListener<DebugTargetCfg>, ConfigurationDeleteListener<DebugTargetCfg>
The debug log publisher implementation that writes debug messages to files on disk. It also maintains the rotation and retention polices of the log files.
-
-
Constructor Summary
Constructors Constructor Description TextDebugLogPublisher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResult
applyConfigurationAdd(DebugTargetCfg config)
Adds a new configuration to this add listener.ConfigChangeResult
applyConfigurationChange(FileBasedDebugLogPublisherCfg config)
Applies the configuration changes to this change listener.ConfigChangeResult
applyConfigurationDelete(DebugTargetCfg config)
Deletes an existing configuration from this delete listener.void
close()
Close this publisher.Dn
getDN()
Gets the DN of the configuration entry for this log publisher.void
initializeLogPublisher(FileBasedDebugLogPublisherCfg cfg, ServerContext serverContext)
Initializes this publisher provider based on the information in the provided debug publisher configuration.boolean
isConfigurationAcceptable(FileBasedDebugLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this log publisher.boolean
isConfigurationAddAcceptable(DebugTargetCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed addition of a new configuration is acceptable to this add listener.boolean
isConfigurationChangeAcceptable(FileBasedDebugLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.boolean
isConfigurationDeleteAcceptable(DebugTargetCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.void
trace(TraceSettings settings, String signature, String sourceLocation, String msg, Throwable exception, StackTraceElement[] stackTrace)
-
-
-
Method Detail
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(FileBasedDebugLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:LogPublisher
Indicates 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.- Specified by:
isConfigurationAcceptable
in interfaceLogPublisher<FileBasedDebugLogPublisherCfg>
- Overrides:
isConfigurationAcceptable
in classDebugLogPublisher<FileBasedDebugLogPublisherCfg>
- Parameters:
config
- 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:
true
if the provided configuration is acceptable for this log publisher, orfalse
if not.
-
initializeLogPublisher
public void initializeLogPublisher(FileBasedDebugLogPublisherCfg cfg, ServerContext serverContext) throws ConfigException, InitializationException
Description copied from interface:LogPublisher
Initializes this publisher provider based on the information in the provided debug publisher configuration.- Specified by:
initializeLogPublisher
in interfaceLogPublisher<FileBasedDebugLogPublisherCfg>
- Parameters:
cfg
- The publisher configuration that contains the information to use to initialize this publisher.serverContext
- The server context.- 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.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(FileBasedDebugLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in interfaceConfigurationChangeListener<FileBasedDebugLogPublisherCfg>
- 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, orfalse
if it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(FileBasedDebugLogPublisherCfg config)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<FileBasedDebugLogPublisherCfg>
- Parameters:
config
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
isConfigurationAddAcceptable
public boolean isConfigurationAddAcceptable(DebugTargetCfg config, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationAddListener
Indicates whether the proposed addition of a new configuration is acceptable to this add listener.- Specified by:
isConfigurationAddAcceptable
in interfaceConfigurationAddListener<DebugTargetCfg>
- 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, orfalse
if it is not.
-
isConfigurationDeleteAcceptable
public boolean isConfigurationDeleteAcceptable(DebugTargetCfg config, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationDeleteListener
Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.- Specified by:
isConfigurationDeleteAcceptable
in interfaceConfigurationDeleteListener<DebugTargetCfg>
- 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, orfalse
if it is not.
-
applyConfigurationAdd
public ConfigChangeResult applyConfigurationAdd(DebugTargetCfg config)
Description copied from interface:ConfigurationAddListener
Adds a new configuration to this add listener.- Specified by:
applyConfigurationAdd
in interfaceConfigurationAddListener<DebugTargetCfg>
- Parameters:
config
- The configuration that will be added.- Returns:
- Returns information about the result of adding the configuration.
-
applyConfigurationDelete
public ConfigChangeResult applyConfigurationDelete(DebugTargetCfg config)
Description copied from interface:ConfigurationDeleteListener
Deletes an existing configuration from this delete listener.- Specified by:
applyConfigurationDelete
in interfaceConfigurationDeleteListener<DebugTargetCfg>
- Parameters:
config
- The existing configuration that will be deleted.- Returns:
- Returns information about the result of deleting the configuration.
-
trace
public void trace(TraceSettings settings, String signature, String sourceLocation, String msg, Throwable exception, StackTraceElement[] stackTrace)
-
close
public void close()
Description copied from interface:LogPublisher
Close this publisher.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceLogPublisher<FileBasedDebugLogPublisherCfg>
-
getDN
public Dn getDN()
Description copied from interface:LogPublisher
Gets the DN of the configuration entry for this log publisher.- Specified by:
getDN
in interfaceLogPublisher<FileBasedDebugLogPublisherCfg>
- Returns:
- The configuration entry DN.
-
-