Class ServletLogChute

java.lang.Object
org.apache.velocity.runtime.log.ServletLogChute
All Implemented Interfaces:
LogChute

public class ServletLogChute extends Object implements LogChute
Simple wrapper for the servlet log. This passes Velocity log messages to ServletContext.log(String). You may configure the level of output in your velocity.properties by adding the "runtime.log.logsystem.servlet.level" property with one of the following values: error, warn, info, debug, or trace. The default is trace.
Since:
1.6
Version:
$Revision: 730039 $ $Date: 2008-12-30 04:53:19 +0100 (Tue, 30 Dec 2008) $
Author:
Geir Magnusson Jr., Nathan Bubna
  • Field Details

  • Constructor Details

    • ServletLogChute

      public ServletLogChute()
      Construct a simple logger for a servlet environment.
      NOTE: this class expects that the ServletContext has already been placed in the runtime's application attributes under its full class name (i.e. "javax.servlet.ServletContext").
  • Method Details

    • init

      public void init(RuntimeServices rs) throws Exception
      init()
      Specified by:
      init in interface LogChute
      Throws:
      IllegalStateException - if the ServletContext is not available in the application attributes under the appropriate key.
      Exception
    • toLevel

      protected int toLevel(String level)
    • 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.
    • 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.
    • log

      public void log(int level, String message)
      Send a log message from Velocity.
      Specified by:
      log in interface LogChute
    • log

      public void log(int level, String message, Throwable t)
      Description copied from interface: LogChute
      Send a log message from Velocity along with an exception or error
      Specified by:
      log in interface LogChute