Class MultiHandler

  • All Implemented Interfaces:
    Comparable<Handler>

    public class MultiHandler
    extends AbstractLogHandler
    Combines multiple handlers.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • m_Handlers

        protected Handler[] m_Handlers
        the logging handlers to use.
    • Constructor Detail

      • MultiHandler

        public MultiHandler()
    • Method Detail

      • setHandlers

        public void setHandlers​(Handler[] value)
        Sets the handlers to use.
        Parameters:
        value - the handlers
      • getHandlers

        public Handler[] getHandlers()
        Returns the current handlers.
        Returns:
        the handlers
      • addHandler

        public void addHandler​(Handler value)
        Adds the specified handler.
        Parameters:
        value - the handler
      • removeHandler

        public void removeHandler​(int index)
        Removes the specified handler.
        Parameters:
        index - the handler index
      • close

        public void close()
                   throws SecurityException
        Close the Handler and free all associated resources.

        The close method will perform a flush and then close the Handler. After close has been called this Handler should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions.

        Overrides:
        close in class AbstractLogHandler
        Throws:
        SecurityException - if a security manager exists and if the caller does not have LoggingPermission("control").
      • doPublish

        protected void doPublish​(LogRecord record)
        Publish a LogRecord.

        The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.

        The Handler is responsible for formatting the message, when and if necessary. The formatting should include localization.

        Specified by:
        doPublish in class AbstractLogHandler
        Parameters:
        record - description of the log event. A null record is silently ignored and is not published
      • compareTo

        public int compareTo​(Handler o)
        Compares the handler with itself.
        Specified by:
        compareTo in interface Comparable<Handler>
        Overrides:
        compareTo in class AbstractLogHandler
        Parameters:
        o - the other handler
        Returns:
        less than 0, equal to 0, or greater than 0 if the handler is less, equal to, or greater than this one