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 ConfigChangeResultapplyConfigurationChange(FileBasedErrorLogPublisherCfg config)Applies the configuration changes to this change listener.voidclose()Close this publisher.static TextErrorLogPublishercreateToolStartupTextErrorPublisher(TextWriter writer)Returns a new text error log publisher which will print all but debug messages to the provided writer.DngetDN()Gets the DN of the configuration entry for this log publisher.voidinitializeLogPublisher(FileBasedErrorLogPublisherCfg config, ServerContext serverContext)Initializes this publisher provider based on the information in the provided debug publisher configuration.booleanisConfigurationAcceptable(FileBasedErrorLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)Indicates whether the provided configuration is acceptable for this log publisher.booleanisConfigurationChangeAcceptable(FileBasedErrorLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.voidlog(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:LogPublisherInitializes this publisher provider based on the information in the provided debug publisher configuration.- Specified by:
initializeLogPublisherin 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: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.- Specified by:
isConfigurationAcceptablein interfaceLogPublisher<FileBasedErrorLogPublisherCfg>- Overrides:
isConfigurationAcceptablein 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:
trueif the provided configuration is acceptable for this log publisher, orfalseif not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(FileBasedErrorLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein 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
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(FileBasedErrorLogPublisherCfg config)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein 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:LogPublisherClose this publisher.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceLogPublisher<FileBasedErrorLogPublisherCfg>
-
getDN
public Dn getDN()
Description copied from interface:LogPublisherGets the DN of the configuration entry for this log publisher.- Specified by:
getDNin interfaceLogPublisher<FileBasedErrorLogPublisherCfg>- Returns:
- The configuration entry DN.
-
log
public void log(String source, long categoryMask, Severity severity, LocalizableMessage message)
Description copied from class:ErrorLogPublisherWrites 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:
login classErrorLogPublisher<C extends ErrorLogPublisherCfg>- Parameters:
source- The category of the message, which is a category name defined inorg.opends.server.loggers.ServerLoggersinterface.categoryMask- The bitmask of the category.severity- The severity of the message.message- The message to be logged.
-
-