Class LogManager

  • All Implemented Interfaces:
    LogHandler

    public class LogManager
    extends java.lang.Object
    implements LogHandler
    Class that wraps a weka.gui.Logger and filters log messages according to the set logging level. Note that warnings and errors reported via the logWarning() and logError() methods will always be output regardless of the logging level set.
    Version:
    $Revision: $
    Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
    • Constructor Summary

      Constructors 
      Constructor Description
      LogManager​(Logger log)
      Constructor that takes a log
      LogManager​(Logger log, boolean status)
      Constructor that takes a log
      LogManager​(Step source)
      Constructor that takes a Step.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Logger getLog()
      Get the wrapped log
      LoggingLevel getLoggingLevel()
      Get the logging level in use
      void log​(java.lang.String message, LoggingLevel messageLevel)
      Log a message at the supplied level
      void logBasic​(java.lang.String message)
      Log at the basic level
      void logDebug​(java.lang.String message)
      Log at the debugging level
      void logDetailed​(java.lang.String message)
      Log at the detailed level
      void logError​(java.lang.String message, java.lang.Exception cause)
      Log an error
      void logLow​(java.lang.String message)
      Log at the low level
      void logWarning​(java.lang.String message)
      Log a warning
      void setLog​(Logger log)
      Set the log wrap
      void setLoggingLevel​(LoggingLevel level)
      Set the logging level to use
      static java.lang.String stackTraceToString​(java.lang.Throwable throwable)
      Utility method to convert a stack trace to a String
      void statusMessage​(java.lang.String message)
      Output a status message
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogManager

        public LogManager​(Step source)
        Constructor that takes a Step. Uses the log from the step
        Parameters:
        source - the source Step
      • LogManager

        public LogManager​(Logger log)
        Constructor that takes a log
        Parameters:
        log - the log to wrap
      • LogManager

        public LogManager​(Logger log,
                          boolean status)
        Constructor that takes a log
        Parameters:
        log - the log to wrap
        status - true if warning and error messages should be output to the status area as well as to the log
    • Method Detail

      • stackTraceToString

        public static java.lang.String stackTraceToString​(java.lang.Throwable throwable)
        Utility method to convert a stack trace to a String
        Parameters:
        throwable - the Throwable to convert to a stack trace string
        Returns:
        the string containing the stack trace
      • setLog

        public void setLog​(Logger log)
        Set the log wrap
        Specified by:
        setLog in interface LogHandler
        Parameters:
        log - the log to wrap
      • getLog

        public Logger getLog()
        Get the wrapped log
        Specified by:
        getLog in interface LogHandler
        Returns:
        the wrapped log
      • getLoggingLevel

        public LoggingLevel getLoggingLevel()
        Get the logging level in use
        Returns:
      • setLoggingLevel

        public void setLoggingLevel​(LoggingLevel level)
        Set the logging level to use
        Parameters:
        level - the level to use
      • logLow

        public void logLow​(java.lang.String message)
        Log at the low level
        Parameters:
        message - the message to log
      • logBasic

        public void logBasic​(java.lang.String message)
        Log at the basic level
        Parameters:
        message - the message to log
      • logDetailed

        public void logDetailed​(java.lang.String message)
        Log at the detailed level
        Parameters:
        message - the message to log
      • logDebug

        public void logDebug​(java.lang.String message)
        Log at the debugging level
        Parameters:
        message - the message to log
      • logWarning

        public void logWarning​(java.lang.String message)
        Log a warning
        Parameters:
        message - the message to log
      • logError

        public void logError​(java.lang.String message,
                             java.lang.Exception cause)
        Log an error
        Parameters:
        message - the message to log
        cause - the cause of the error
      • statusMessage

        public void statusMessage​(java.lang.String message)
        Output a status message
        Parameters:
        message - the status message
      • log

        public void log​(java.lang.String message,
                        LoggingLevel messageLevel)
        Log a message at the supplied level
        Parameters:
        message - the message to log
        messageLevel - the level to log at