Class SystemLogChute

  • All Implemented Interfaces:
    LogChute

    public class SystemLogChute
    extends java.lang.Object
    implements LogChute
    Logger used when no other is configured. By default, all messages will be printed to the System.err output stream.
    Since:
    1.5
    Version:
    $Id: SystemLogChute.java 730039 2008-12-30 03:53:19Z byron $
    • Constructor Summary

      Constructors 
      Constructor Description
      SystemLogChute()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getEnabledLevel()
      Returns the current minimum level at which messages will be printed.
      protected java.lang.String getPrefix​(int level)  
      int getSystemErrLevel()
      Returns the current minimum level at which messages will be printed to System.err instead of System.out.
      void init​(RuntimeServices rs)
      Initializes this LogChute.
      boolean isLevelEnabled​(int level)
      This will return true if the specified level is equal to or higher than the level this LogChute is enabled for.
      void log​(int level, java.lang.String message)
      Logs messages to either std.out or std.err depending on their severity.
      void log​(int level, java.lang.String message, java.lang.Throwable t)
      Logs messages to the system console so long as the specified level is equal to or greater than the level this LogChute is enabled for.
      void setEnabledLevel​(int level)
      Set the minimum level at which messages will be printed.
      void setSystemErrLevel​(int level)
      Set the minimum level at which messages will be printed to System.err instead of System.out.
      protected int toLevel​(java.lang.String level)  
      protected void write​(java.io.PrintStream stream, java.lang.String prefix, java.lang.String message, java.lang.Throwable t)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RUNTIME_LOG_LEVEL_KEY

        public static final java.lang.String RUNTIME_LOG_LEVEL_KEY
        See Also:
        Constant Field Values
      • RUNTIME_LOG_SYSTEM_ERR_LEVEL_KEY

        public static final java.lang.String RUNTIME_LOG_SYSTEM_ERR_LEVEL_KEY
        See Also:
        Constant Field Values
      • enabled

        private int enabled
      • errLevel

        private int errLevel
    • Constructor Detail

      • SystemLogChute

        public SystemLogChute()
    • Method Detail

      • init

        public void init​(RuntimeServices rs)
                  throws java.lang.Exception
        Description copied from interface: LogChute
        Initializes this LogChute.
        Specified by:
        init in interface LogChute
        Throws:
        java.lang.Exception
      • toLevel

        protected int toLevel​(java.lang.String level)
      • getPrefix

        protected java.lang.String getPrefix​(int level)
      • log

        public void log​(int level,
                        java.lang.String message)
        Logs messages to either std.out or std.err depending on their severity.
        Specified by:
        log in interface LogChute
        Parameters:
        level - severity level
        message - complete error message
      • log

        public void log​(int level,
                        java.lang.String message,
                        java.lang.Throwable t)
        Logs messages to the system console so long as the specified level is equal to or greater than the level this LogChute is enabled for. If the level is equal to or greater than LogChute.ERROR_ID, messages will be printed to System.err. Otherwise, they will be printed to System.out. If a java.lang.Throwable accompanies the message, it's stack trace will be printed to the same stream as the message.
        Specified by:
        log in interface LogChute
        Parameters:
        level - severity level
        message - complete error message
        t - the java.lang.Throwable
      • write

        protected void write​(java.io.PrintStream stream,
                             java.lang.String prefix,
                             java.lang.String message,
                             java.lang.Throwable t)
      • setEnabledLevel

        public void setEnabledLevel​(int level)
        Set the minimum level at which messages will be printed.
      • getEnabledLevel

        public int getEnabledLevel()
        Returns the current minimum level at which messages will be printed.
      • setSystemErrLevel

        public void setSystemErrLevel​(int level)
        Set the minimum level at which messages will be printed to System.err instead of System.out.
      • getSystemErrLevel

        public int getSystemErrLevel()
        Returns the current minimum level at which messages will be printed to System.err instead of System.out.
      • isLevelEnabled

        public boolean isLevelEnabled​(int level)
        This will return true if the specified level is equal to or higher than the level this LogChute is enabled for.
        Specified by:
        isLevelEnabled in interface LogChute
        Returns:
        True if a level is enabled.