Class LoggerSet

  • All Implemented Interfaces:
    Logger

    public final class LoggerSet
    extends Object
    implements Logger
    Dispatch log information to a set of registered loggers.

    When a logging facility (debug(), error(), etc.) is called, this implementation just redirects the call to every registered logger.

    This logger can be particularly useful for example to log information into a file and also to System streams :

     workbench.getConfiguration().setLogger(new LoggerSet(new Logger[] { new FileLogger(new File("myFile.log")), new SystemStreamLogger() }));
     

    Clients may instantiate this class.

    • Constructor Detail

      • LoggerSet

        public LoggerSet​(Logger[] loggers)
        Constructs a new LoggerSet that will dispatch log information to the specified loggers.
        Parameters:
        loggers - the sub loggers this logger is in charge of.
    • Method Detail

      • getLevel

        public Level getLevel()
        Description copied from interface: Logger
        Get the log Level that has been specified for this logger. The default level is INFO.
        Specified by:
        getLevel in interface Logger
        Returns:
        the log Level that has been specified for this logger (never null).
      • setLevel

        public void setLevel​(Level level)
        Description copied from interface: Logger
        Set the log level specifying which message levels will be logged by this logger. Message levels lower than this value will be discarded.
        Specified by:
        setLevel in interface Logger
        Parameters:
        level - the new level to use.
      • isLoggable

        public boolean isLoggable​(Level level)
        Description copied from interface: Logger
        Check if a message of the given level would actually be logged by this logger. This check is based on the logger effective level.
        Specified by:
        isLoggable in interface Logger
        Parameters:
        level - a message logging level.
        Returns:
        true if the given message level is currently being logged.
      • debug

        public void debug​(Object message)
        Description copied from interface: Logger
        Logs a debug level message.

        Debug messages are used to assist in debugging problems that may be associated with particular configurations.

        Specified by:
        debug in interface Logger
        Parameters:
        message - the information to log (usually a String)
      • debug

        public void debug​(Object message,
                          String filename,
                          int lineNumber,
                          int columnNumber)
        Description copied from interface: Logger
        Logs a debug level message.

        This method is typically used when parsing a model file and when a parsing debug information must be logged.

        Debug messages are used to assist in debugging problems that may be associated with particular configurations.

        Specified by:
        debug in interface Logger
        Parameters:
        message - the information to log (usually a String)
        filename - the current file from which this message originates.
        lineNumber - the current file line number.
        columnNumber - the current file column number.
      • debug

        public void debug​(Object message,
                          Throwable error)
        Description copied from interface: Logger
        Logs a debug level message.

        Debug messages are used to assist in debugging problems that may be associated with particular configurations.

        Specified by:
        debug in interface Logger
        Parameters:
        message - the information to log (usually a String), maybe null
        error - an exception to log.
      • info

        public void info​(Object message)
        Description copied from interface: Logger
        Logs an info level message.

        Info messages should only be used for reasonably significant messages that will make sense to end users and system admins.

        Specified by:
        info in interface Logger
        Parameters:
        message - the information to log (usually a String)
      • info

        public void info​(Object message,
                         String filename,
                         int lineNumber,
                         int columnNumber)
        Description copied from interface: Logger
        Logs an info level message, with the specified file location.

        This method is typically used when parsing a model file and when a parsing information must be logged.

        Info messages should only be used for reasonably significant messages that will make sense to end users and system admins.

        Specified by:
        info in interface Logger
        Parameters:
        message - the information to log (usually a String)
        filename - the current file from which this message originates.
        lineNumber - the current file line number.
        columnNumber - the current file column number.
      • info

        public void info​(Object message,
                         Throwable error)
        Description copied from interface: Logger
        Logs an info level message.

        Info messages should only be used for reasonably significant messages that will make sense to end users and system admins.

        Specified by:
        info in interface Logger
        Parameters:
        message - the information to log (usually a String), maybe null
        error - an exception to log.
      • warning

        public void warning​(Object message)
        Description copied from interface: Logger
        Logs a warning level message.

        In general, warning messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.

        Specified by:
        warning in interface Logger
        Parameters:
        message - the information to log (usually a String)
      • warning

        public void warning​(Object message,
                            String filename,
                            int lineNumber,
                            int columnNumber)
        Description copied from interface: Logger
        Logs a warning level message.

        This method is typically used when parsing a model file and when a parsing warning must be logged.

        In general, warning messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.

        Specified by:
        warning in interface Logger
        Parameters:
        message - the information to log (usually a String)
        filename - the current file from which this message originates.
        lineNumber - the current file line number.
        columnNumber - the current file column number.
      • warning

        public void warning​(Object message,
                            Throwable error)
        Description copied from interface: Logger
        Logs a warning level message.

        In general, warning messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.

        Specified by:
        warning in interface Logger
        Parameters:
        message - the information to log (usually a String), maybe null
        error - an exception to log.
      • error

        public void error​(Object message)
        Description copied from interface: Logger
        Logs an error level message.

        In general, error messages should describe events that are of considerable importance and which will prevent normal program execution. They should be reasonably intelligible to end users and to system administrators.

        Specified by:
        error in interface Logger
        Parameters:
        message - the information to log (usually a String)
      • error

        public void error​(Object message,
                          String filename,
                          int lineNumber,
                          int columnNumber)
        Description copied from interface: Logger
        Logs an error level message.

        This method is typically used when parsing a model file and when a parsing recoverable error must be logged.

        In general, error messages should describe events that are of considerable importance and which will prevent normal program execution. They should be reasonably intelligible to end users and to system administrators.

        Specified by:
        error in interface Logger
        Parameters:
        message - the information to log (usually a String)
        filename - the current file from which this message originates.
        lineNumber - the current file line number.
        columnNumber - the current file column number.
      • error

        public void error​(Object message,
                          Throwable error)
        Description copied from interface: Logger
        Logs an error level message.

        In general, error messages should describe events that are of considerable importance and which will prevent normal program execution. They should be reasonably intelligible to end users and to system administrators.

        Specified by:
        error in interface Logger
        Parameters:
        message - the information to log (usually a String), maybe null
        error - an exception to log.