Class TextErrorLogPublisher

    • Constructor Detail

      • TextErrorLogPublisher

        public TextErrorLogPublisher()
    • Method Detail

      • getToolStartupTextErrorPublisher

        public static TextErrorLogPublisher getToolStartupTextErrorPublisher​(TextWriter writer)
        Returns a new text error log publisher which will print all 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.
      • getServerStartupTextErrorPublisher

        public 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. This less verbose publisher should be used by the directory server during startup.
        Parameters:
        writer - The text writer where the message will be written to.
        Returns:
        A new text error log publisher which will print only notices, severe warnings and errors, and fatal errors messages to the provided writer.
      • isConfigurationAcceptable

        public boolean isConfigurationAcceptable​(FileBasedErrorLogPublisherCfg config,
                                                 List<org.forgerock.i18n.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.

        Note that implementations which use a subclass of the provided configuration class will likely need to cast the configuration to the appropriate subclass type.
        Specified by:
        isConfigurationAcceptable in interface LogPublisher<FileBasedErrorLogPublisherCfg>
        Overrides:
        isConfigurationAcceptable in class ErrorLogPublisher<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, or false if not.
      • isConfigurationChangeAcceptable

        public boolean isConfigurationChangeAcceptable​(FileBasedErrorLogPublisherCfg config,
                                                       List<org.forgerock.i18n.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 interface ConfigurationChangeListener<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, or false if it is not.
      • log

        public void log​(String source,
                        Severity severity,
                        org.forgerock.i18n.LocalizableMessage message,
                        Throwable exception)
        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.

        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.

        Specified by:
        log in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
        Parameters:
        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.
      • isEnabledFor

        public boolean isEnabledFor​(String category,
                                    Severity severity)
        Description copied from class: ErrorLogPublisher
        Check if a message should be logged for the provided category and severity.
        Specified by:
        isEnabledFor in class ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
        Parameters:
        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.
        Returns:
        true if the message should be logged, false otherwise