Package org.opends.server.loggers
Class ConsoleErrorLogPublisher
- java.lang.Object
-
- org.opends.server.loggers.ErrorLogPublisher<C>
-
- org.opends.server.loggers.ConsoleErrorLogPublisher
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConfigurationChangeListener<ConsoleErrorLogPublisherCfg>
,LogPublisher<ConsoleErrorLogPublisherCfg>
public final class ConsoleErrorLogPublisher extends ErrorLogPublisher<C> implements ConfigurationChangeListener<ConsoleErrorLogPublisherCfg>
This class provides an implementation of an error log publisher.
-
-
Constructor Summary
Constructors Constructor Description ConsoleErrorLogPublisher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResult
applyConfigurationChange(ConsoleErrorLogPublisherCfg config)
Applies the configuration changes to this change listener.void
close()
Close this publisher.Dn
getDN()
Gets the DN of the configuration entry for this log publisher.void
initializeLogPublisher(ConsoleErrorLogPublisherCfg config, ServerContext serverContext)
Initializes this publisher provider based on the information in the provided debug publisher configuration.boolean
isConfigurationAcceptable(ConsoleErrorLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this log publisher.boolean
isConfigurationChangeAcceptable(ConsoleErrorLogPublisherCfg 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
-
initializeLogPublisher
public void initializeLogPublisher(ConsoleErrorLogPublisherCfg config, ServerContext serverContext) throws ConfigException
Description copied from interface:LogPublisher
Initializes this publisher provider based on the information in the provided debug publisher configuration.- Specified by:
initializeLogPublisher
in interfaceLogPublisher<ConsoleErrorLogPublisherCfg>
- 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.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(ConsoleErrorLogPublisherCfg 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<ConsoleErrorLogPublisherCfg>
- Overrides:
isConfigurationAcceptable
in classErrorLogPublisher<ConsoleErrorLogPublisherCfg>
- 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(ConsoleErrorLogPublisherCfg 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<ConsoleErrorLogPublisherCfg>
- 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(ConsoleErrorLogPublisherCfg config)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<ConsoleErrorLogPublisherCfg>
- 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<ConsoleErrorLogPublisherCfg>
-
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<ConsoleErrorLogPublisherCfg>
- 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.
-
-