Class LogSystemCommonsLog

  • All Implemented Interfaces:
    org.apache.commons.logging.Log

    public class LogSystemCommonsLog
    extends java.lang.Object
    implements org.apache.commons.logging.Log
    Redirects commons-logging messages to Velocity's LogSystem.

    To use, specify this class in your commons-logging.properties: org.apache.commons.logging.Log=org.apache.velocity.tools.generic.log.LogSystemCommonsLog

    Version:
    $Id: LogSystemCommonsLog.java 493518 2007-01-06 17:47:14Z cbrisson $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.apache.velocity.app.VelocityEngine handler  
      private boolean printStackTrace  
    • Constructor Summary

      Constructors 
      Constructor Description
      LogSystemCommonsLog()  
      LogSystemCommonsLog​(boolean pst)
      Lets you set whether or not this instance should print the full stack trace of exceptions and errors passed to it.
      LogSystemCommonsLog​(boolean pst, java.lang.String name)
      Lets you set whether or not this instance should print the full stack trace of exceptions and errors passed to it.
      LogSystemCommonsLog​(java.lang.String name)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void debug​(java.lang.Object message)
      Passes messages to Velocity's LogSystem at "DEBUG" level.
      void debug​(java.lang.Object message, java.lang.Throwable t)
      Passes messages to Velocity's LogSystem at "DEBUG" level.
      void error​(java.lang.Object message)
      Passes messages to Velocity's LogSystem at "ERROR" level.
      void error​(java.lang.Object message, java.lang.Throwable t)
      Passes messages to Velocity's LogSystem at "ERROR" level.
      void fatal​(java.lang.Object message)
      Passes messages to Velocity's LogSystem at "ERROR" level.
      void fatal​(java.lang.Object message, java.lang.Throwable t)
      Passes messages to Velocity's LogSystem at "ERROR" level.
      void info​(java.lang.Object message)
      Passes messages to Velocity's LogSystem at "INFO" level.
      void info​(java.lang.Object message, java.lang.Throwable t)
      Passes messages to Velocity's LogSystem at "INFO" level.
      boolean isDebugEnabled()
      Always returns true since Velocity's LogSystem doesn't provide this information.
      boolean isErrorEnabled()
      Always returns true since Velocity's LogSystem doesn't provide this information.
      boolean isFatalEnabled()
      Always returns true since Velocity's LogSystem doesn't provide this information.
      boolean isInfoEnabled()
      Always returns true since Velocity's LogSystem doesn't provide this information.
      boolean isTraceEnabled()
      Always returns true since Velocity's LogSystem doesn't provide this information.
      boolean isWarnEnabled()
      Always returns true since Velocity's LogSystem doesn't provide this information.
      private void log​(int level, java.lang.Object message)  
      private void log​(int level, java.lang.Object message, java.lang.Throwable t)  
      static void setVelocityEngine​(org.apache.velocity.app.VelocityEngine engine)
      Set a VelocityEngine to handle all the log messages.
      void trace​(java.lang.Object message)
      Passes messages to Velocity's LogSystem at "DEBUG" level.
      void trace​(java.lang.Object message, java.lang.Throwable t)
      Passes messages to Velocity's LogSystem at "DEBUG" level.
      void warn​(java.lang.Object message)
      Passes messages to Velocity's LogSystem at "WARN" level.
      void warn​(java.lang.Object message, java.lang.Throwable t)
      Passes messages to Velocity's LogSystem at "WARN" level.
      • Methods inherited from class java.lang.Object

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

      • handler

        protected static org.apache.velocity.app.VelocityEngine handler
      • printStackTrace

        private boolean printStackTrace
    • Constructor Detail

      • LogSystemCommonsLog

        public LogSystemCommonsLog()
      • LogSystemCommonsLog

        public LogSystemCommonsLog​(java.lang.String name)
      • LogSystemCommonsLog

        public LogSystemCommonsLog​(boolean pst)
        Lets you set whether or not this instance should print the full stack trace of exceptions and errors passed to it.

        It should be possible to create a LogFactory implementation that takes advantage of this constructor.

        Parameters:
        pst - if true, stack traces will be printed
      • LogSystemCommonsLog

        public LogSystemCommonsLog​(boolean pst,
                                   java.lang.String name)
        Lets you set whether or not this instance should print the full stack trace of exceptions and errors passed to it.

        It should be possible to create a LogFactory implementation that takes advantage of this constructor.

        Parameters:
        pst - if true, stack traces will be printed
        name - the name of this logger
    • Method Detail

      • setVelocityEngine

        public static void setVelocityEngine​(org.apache.velocity.app.VelocityEngine engine)
        Set a VelocityEngine to handle all the log messages.
      • log

        private void log​(int level,
                         java.lang.Object message)
      • log

        private void log​(int level,
                         java.lang.Object message,
                         java.lang.Throwable t)
      • trace

        public void trace​(java.lang.Object message)
        Passes messages to Velocity's LogSystem at "DEBUG" level. (it's the lowest available. sorry.)
        Specified by:
        trace in interface org.apache.commons.logging.Log
      • trace

        public void trace​(java.lang.Object message,
                          java.lang.Throwable t)
        Passes messages to Velocity's LogSystem at "DEBUG" level. (it's the lowest available. sorry.)
        Specified by:
        trace in interface org.apache.commons.logging.Log
      • debug

        public void debug​(java.lang.Object message)
        Passes messages to Velocity's LogSystem at "DEBUG" level.
        Specified by:
        debug in interface org.apache.commons.logging.Log
      • debug

        public void debug​(java.lang.Object message,
                          java.lang.Throwable t)
        Passes messages to Velocity's LogSystem at "DEBUG" level.
        Specified by:
        debug in interface org.apache.commons.logging.Log
      • info

        public void info​(java.lang.Object message)
        Passes messages to Velocity's LogSystem at "INFO" level.
        Specified by:
        info in interface org.apache.commons.logging.Log
      • info

        public void info​(java.lang.Object message,
                         java.lang.Throwable t)
        Passes messages to Velocity's LogSystem at "INFO" level.
        Specified by:
        info in interface org.apache.commons.logging.Log
      • warn

        public void warn​(java.lang.Object message)
        Passes messages to Velocity's LogSystem at "WARN" level.
        Specified by:
        warn in interface org.apache.commons.logging.Log
      • warn

        public void warn​(java.lang.Object message,
                         java.lang.Throwable t)
        Passes messages to Velocity's LogSystem at "WARN" level.
        Specified by:
        warn in interface org.apache.commons.logging.Log
      • error

        public void error​(java.lang.Object message)
        Passes messages to Velocity's LogSystem at "ERROR" level.
        Specified by:
        error in interface org.apache.commons.logging.Log
      • error

        public void error​(java.lang.Object message,
                          java.lang.Throwable t)
        Passes messages to Velocity's LogSystem at "ERROR" level.
        Specified by:
        error in interface org.apache.commons.logging.Log
      • fatal

        public void fatal​(java.lang.Object message)
        Passes messages to Velocity's LogSystem at "ERROR" level. (it's the highest available. sorry.)
        Specified by:
        fatal in interface org.apache.commons.logging.Log
      • fatal

        public void fatal​(java.lang.Object message,
                          java.lang.Throwable t)
        Passes messages to Velocity's LogSystem at "ERROR" level. (it's the highest available. sorry.)
        Specified by:
        fatal in interface org.apache.commons.logging.Log
      • isTraceEnabled

        public boolean isTraceEnabled()
        Always returns true since Velocity's LogSystem doesn't provide this information.
        Specified by:
        isTraceEnabled in interface org.apache.commons.logging.Log
        Returns:
        true
      • isDebugEnabled

        public boolean isDebugEnabled()
        Always returns true since Velocity's LogSystem doesn't provide this information.
        Specified by:
        isDebugEnabled in interface org.apache.commons.logging.Log
        Returns:
        true
      • isInfoEnabled

        public boolean isInfoEnabled()
        Always returns true since Velocity's LogSystem doesn't provide this information.
        Specified by:
        isInfoEnabled in interface org.apache.commons.logging.Log
        Returns:
        true
      • isWarnEnabled

        public boolean isWarnEnabled()
        Always returns true since Velocity's LogSystem doesn't provide this information.
        Specified by:
        isWarnEnabled in interface org.apache.commons.logging.Log
        Returns:
        true
      • isErrorEnabled

        public boolean isErrorEnabled()
        Always returns true since Velocity's LogSystem doesn't provide this information.
        Specified by:
        isErrorEnabled in interface org.apache.commons.logging.Log
        Returns:
        true
      • isFatalEnabled

        public boolean isFatalEnabled()
        Always returns true since Velocity's LogSystem doesn't provide this information.
        Specified by:
        isFatalEnabled in interface org.apache.commons.logging.Log
        Returns:
        true