public class TextErrorLogPublisher extends ErrorLogPublisher<FileBasedErrorLogPublisherCfg> implements ConfigurationChangeListener<FileBasedErrorLogPublisherCfg>
defaultSeverities, definedSeverities
Constructor and Description |
---|
TextErrorLogPublisher() |
Modifier and Type | Method and Description |
---|---|
ConfigChangeResult |
applyConfigurationChange(FileBasedErrorLogPublisherCfg 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.
|
static TextErrorLogPublisher |
getServerStartupTextErrorPublisher(TextWriter writer)
Returns a new text error log publisher which will print only notices, severe warnings and errors, and fatal
errors messages to the provided writer.
|
static TextErrorLogPublisher |
getToolStartupTextErrorPublisher(TextWriter writer)
Returns a new text error log publisher which will print all messages to the provided writer.
|
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.
|
boolean |
isEnabledFor(String category,
Severity severity)
Check if a message should be logged for the provided category and severity.
|
void |
log(String source,
Severity severity,
LocalizableMessage message,
Throwable exception)
Writes a message to the error log using the provided information.
|
public static TextErrorLogPublisher getToolStartupTextErrorPublisher(TextWriter writer)
writer
- The text writer where the message will be written to.public static TextErrorLogPublisher getServerStartupTextErrorPublisher(TextWriter writer)
writer
- The text writer where the message will be written to.public void initializeLogPublisher(FileBasedErrorLogPublisherCfg config, ServerContext serverContext) throws ConfigException, InitializationException
LogPublisher
initializeLogPublisher
in interface LogPublisher<FileBasedErrorLogPublisherCfg>
config
- The publisher configuration that contains the information to use to initialize this publisher.serverContext
- The server context.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.public boolean isConfigurationAcceptable(FileBasedErrorLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
LogPublisher
isConfigurationAcceptable
in interface LogPublisher<FileBasedErrorLogPublisherCfg>
isConfigurationAcceptable
in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
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.true
if the provided configuration is acceptable for this log publisher, or false
if not.public boolean isConfigurationChangeAcceptable(FileBasedErrorLogPublisherCfg config, List<LocalizableMessage> unacceptableReasons)
ConfigurationChangeListener
isConfigurationChangeAcceptable
in interface ConfigurationChangeListener<FileBasedErrorLogPublisherCfg>
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.true
if the proposed change is acceptable,
or false
if it is not.public ConfigChangeResult applyConfigurationChange(FileBasedErrorLogPublisherCfg config)
ConfigurationChangeListener
applyConfigurationChange
in interface ConfigurationChangeListener<FileBasedErrorLogPublisherCfg>
config
- The new configuration containing the changes.public void close()
LogPublisher
close
in interface Closeable
close
in interface AutoCloseable
close
in interface LogPublisher<FileBasedErrorLogPublisherCfg>
public void log(String source, Severity severity, LocalizableMessage message, Throwable exception)
ErrorLogPublisher
The category and severity information are used to determine whether to actually log this message.
Category is defined using either short name (used for classes in well defined packages) or fully qualified
classname. Conversion to short name is done automatically when loggers are created, see
LoggingCategoryNames
for list of existing short names.
log
in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
source
- The category of the message, which is either a classname or a simple category name defined in
LoggingCategoryNames
class.severity
- The severity of the message.message
- The message to be logged.exception
- The exception to be logged. May be null
.public boolean isEnabledFor(String category, Severity severity)
ErrorLogPublisher
isEnabledFor
in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
category
- The category of the message, which is either a classname or a simple category name defined in
LoggingCategoryNames
class.severity
- The severity of the message.true
if the message should be logged, false
otherwisepublic Dn getDN()
LogPublisher
getDN
in interface LogPublisher<FileBasedErrorLogPublisherCfg>
Copyright 2010-2022 ForgeRock AS.