Package helma.util

Class Logger

  • All Implemented Interfaces:
    org.apache.commons.logging.Log
    Direct Known Subclasses:
    FileLogger

    public class Logger
    extends java.lang.Object
    implements org.apache.commons.logging.Log
    A simple logger that writes to a PrintStream such as System.out.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEBUG  
      static int ERROR  
      static int FATAL  
      static int INFO  
      static int TRACE  
      static int WARN  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Logger​(java.io.PrintStream out)
      Create a logger for a PrintStream, such as System.out.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void debug​(java.lang.Object parm1)  
      void debug​(java.lang.Object parm1, java.lang.Throwable parm2)  
      protected void ensureOpen()
      This is called by the runner thread to to make sure we have an open writer.
      void error​(java.lang.Object parm1)  
      void error​(java.lang.Object parm1, java.lang.Throwable parm2)  
      void fatal​(java.lang.Object parm1)  
      void fatal​(java.lang.Object parm1, java.lang.Throwable parm2)  
      java.lang.String getCanonicalName()
      Return an object which identifies this logger.
      int getLogLevel()
      Get the current log level.
      protected org.apache.commons.logging.Log getSedatedLog()
      return a "quiet" version of this log that routes debug() output to trace()
      static java.lang.String getStackTrace​(java.lang.Throwable t)  
      void info​(java.lang.Object parm1)  
      void info​(java.lang.Object parm1, java.lang.Throwable parm2)  
      boolean isDebugEnabled()  
      boolean isErrorEnabled()  
      boolean isFatalEnabled()  
      boolean isInfoEnabled()  
      boolean isTraceEnabled()  
      boolean isWarnEnabled()  
      protected void log​(java.lang.String level, java.lang.Object msg, java.lang.Throwable exception)
      Append a message to the log.
      protected static void renderDate()  
      void setLogLevel​(int logLevel)
      Set the log level for this logger.
      java.lang.String toString()
      Return a string representation of this Logger
      void trace​(java.lang.Object parm1)  
      void trace​(java.lang.Object parm1, java.lang.Throwable parm2)  
      void warn​(java.lang.Object parm1)  
      void warn​(java.lang.Object parm1, java.lang.Throwable parm2)  
      protected void write()
      This is called by the runner thread to perform actual output.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Logger

        protected Logger​(java.io.PrintStream out)
        Create a logger for a PrintStream, such as System.out.
        Parameters:
        out - the output stream
    • Method Detail

      • getLogLevel

        public int getLogLevel()
        Get the current log level.
        Returns:
        the current log level
      • setLogLevel

        public void setLogLevel​(int logLevel)
        Set the log level for this logger.
        Parameters:
        logLevel - the new log level
      • toString

        public java.lang.String toString()
        Return a string representation of this Logger
        Overrides:
        toString in class java.lang.Object
      • getCanonicalName

        public java.lang.String getCanonicalName()
        Return an object which identifies this logger.
        Returns:
        the canonical name of this logger
      • log

        protected void log​(java.lang.String level,
                           java.lang.Object msg,
                           java.lang.Throwable exception)
        Append a message to the log.
        Parameters:
        level - a string representing the log level
        msg - the log message
        exception - an exception, or null
      • write

        protected void write()
        This is called by the runner thread to perform actual output.
      • ensureOpen

        protected void ensureOpen()
        This is called by the runner thread to to make sure we have an open writer.
      • renderDate

        protected static void renderDate()
      • isTraceEnabled

        public boolean isTraceEnabled()
        Specified by:
        isTraceEnabled in interface org.apache.commons.logging.Log
      • isDebugEnabled

        public boolean isDebugEnabled()
        Specified by:
        isDebugEnabled in interface org.apache.commons.logging.Log
      • isInfoEnabled

        public boolean isInfoEnabled()
        Specified by:
        isInfoEnabled in interface org.apache.commons.logging.Log
      • isWarnEnabled

        public boolean isWarnEnabled()
        Specified by:
        isWarnEnabled in interface org.apache.commons.logging.Log
      • isErrorEnabled

        public boolean isErrorEnabled()
        Specified by:
        isErrorEnabled in interface org.apache.commons.logging.Log
      • isFatalEnabled

        public boolean isFatalEnabled()
        Specified by:
        isFatalEnabled in interface org.apache.commons.logging.Log
      • trace

        public void trace​(java.lang.Object parm1)
        Specified by:
        trace in interface org.apache.commons.logging.Log
      • trace

        public void trace​(java.lang.Object parm1,
                          java.lang.Throwable parm2)
        Specified by:
        trace in interface org.apache.commons.logging.Log
      • debug

        public void debug​(java.lang.Object parm1)
        Specified by:
        debug in interface org.apache.commons.logging.Log
      • debug

        public void debug​(java.lang.Object parm1,
                          java.lang.Throwable parm2)
        Specified by:
        debug in interface org.apache.commons.logging.Log
      • info

        public void info​(java.lang.Object parm1)
        Specified by:
        info in interface org.apache.commons.logging.Log
      • info

        public void info​(java.lang.Object parm1,
                         java.lang.Throwable parm2)
        Specified by:
        info in interface org.apache.commons.logging.Log
      • warn

        public void warn​(java.lang.Object parm1)
        Specified by:
        warn in interface org.apache.commons.logging.Log
      • warn

        public void warn​(java.lang.Object parm1,
                         java.lang.Throwable parm2)
        Specified by:
        warn in interface org.apache.commons.logging.Log
      • error

        public void error​(java.lang.Object parm1)
        Specified by:
        error in interface org.apache.commons.logging.Log
      • error

        public void error​(java.lang.Object parm1,
                          java.lang.Throwable parm2)
        Specified by:
        error in interface org.apache.commons.logging.Log
      • fatal

        public void fatal​(java.lang.Object parm1)
        Specified by:
        fatal in interface org.apache.commons.logging.Log
      • fatal

        public void fatal​(java.lang.Object parm1,
                          java.lang.Throwable parm2)
        Specified by:
        fatal in interface org.apache.commons.logging.Log
      • getStackTrace

        public static java.lang.String getStackTrace​(java.lang.Throwable t)
      • getSedatedLog

        protected org.apache.commons.logging.Log getSedatedLog()
        return a "quiet" version of this log that routes debug() output to trace()
        Returns:
        a possibly less verbose version of this log.