Package org.opends.server.loggers
Class TextErrorLogPublisher
- java.lang.Object
-
- org.opends.server.loggers.ErrorLogPublisher<C>
-
- org.opends.server.loggers.TextErrorLogPublisher
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConfigurationChangeListener<FileBasedErrorLogPublisherCfg>
,LogPublisher<FileBasedErrorLogPublisherCfg>
public final class TextErrorLogPublisher extends ErrorLogPublisher<C> implements ConfigurationChangeListener<FileBasedErrorLogPublisherCfg>
This class provides an implementation of an error log publisher.
-
-
Constructor Summary
Constructors Constructor Description TextErrorLogPublisher()
Creates a new file-based text error log publisher.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResult
applyConfigurationChange(FileBasedErrorLogPublisherCfg config)
Applies the configuration changes to this change listener.void
close()
Close this publisher.static TextErrorLogPublisher
createToolStartupTextErrorPublisher(TextWriter writer)
Returns a new text error log publisher which will print all but debug messages to the provided writer.Dn
getDN()
Gets the DN of the configuration entry for this log publisher.void
initializeLogPublisher(FileBasedErrorLogPublisherCfg config, ServerContext serverContext)
Initializes this publisher provider based on the information in the provided debug publisher configuration.boolean
isConfigurationAcceptable(FileBasedErrorLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this log publisher.boolean
isConfigurationChangeAcceptable(FileBasedErrorLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.void
log(String source, long categoryMask, Severity severity, LocalizableMessage message)
Writes a message to the error log using the provided information.
-
-
-
Method Detail
-
createToolStartupTextErrorPublisher
public static TextErrorLogPublisher createToolStartupTextErrorPublisher(TextWriter writer)
Returns a new text error log publisher which will print all but debug messages to the provided writer. This publisher should be used by tools.- Parameters:
writer
- The text writer where the message will be written to.- Returns:
- A new text error log publisher which will print all messages to the provided writer.
-
initializeLogPublisher
public void initializeLogPublisher(FileBasedErrorLogPublisherCfg config, 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<FileBasedErrorLogPublisherCfg>
- Parameters:
config
- 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.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(FileBasedErrorLogPublisherCfg 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<FileBasedErrorLogPublisherCfg>
- Overrides:
isConfigurationAcceptable
in classErrorLogPublisher<FileBasedErrorLogPublisherCfg>
- 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.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(FileBasedErrorLogPublisherCfg 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<FileBasedErrorLogPublisherCfg>
- 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(FileBasedErrorLogPublisherCfg config)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<FileBasedErrorLogPublisherCfg>
- Parameters:
config
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
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<FileBasedErrorLogPublisherCfg>
-
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<FileBasedErrorLogPublisherCfg>
- Returns:
- The configuration entry DN.
-
log
public void log(String source, long categoryMask, Severity severity, LocalizableMessage message)
Description copied from class:ErrorLogPublisher
Writes a message to the error log using the provided information.The category and severity information are used to determine whether to actually log this message.
- Specified by:
log
in classErrorLogPublisher<C extends ErrorLogPublisherCfg>
- Parameters:
source
- The category of the message, which is a category name defined inorg.opends.server.loggers.ServerLoggers
interface.categoryMask
- The bitmask of the category.severity
- The severity of the message.message
- The message to be logged.
-
-