Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.velocity.runtime.log
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-29 19:53:19 -0800 (Mon, 29 Dec 2008) $
Author:
  Geir Magnusson Jr., Nathan Bubna

Field Summary
`static String` | `PREFIX`
`static String` | `RUNTIME_LOG_LEVEL_KEY`
`protected ServletContext` | `servletContext`

Fields inherited from interface org.apache.velocity.runtime.log.LogChute
`DEBUG_ID, DEBUG_PREFIX, ERROR_ID, ERROR_PREFIX, INFO_ID, INFO_PREFIX, TRACE_ID, TRACE_PREFIX, WARN_ID, WARN_PREFIX`

Constructor Summary
`ServletLogChute()` Construct a simple logger for a servlet environment.

Method Summary
`int` | `getEnabledLevel()` Returns the current minimum level at which messages will be printed.
`void` | `init(RuntimeServices rs)` init()
`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, String message)` Send a log message from Velocity.
`void` | `log(int level, String message, Throwable t)` Send a log message from Velocity along with an exception or error
`void` | `setEnabledLevel(int level)` Set the minimum level at which messages will be printed.
`protected int` | `toLevel(String level)`

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 String RUNTIME_LOG_LEVEL_KEY

See Also:
  Constant Field Values

### servletContext

    protected ServletContext servletContext

### PREFIX

    public static final String PREFIX

See Also:
  Constant Field Values

Constructor Detail

### 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 Detail

### init

    public void init(RuntimeServices rs)
              throws Exception

  init()

  Specified by:
    `init` in interface `LogChute`
  Parameters:
    `rs` -
  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`
  Parameters:
    `level` -
  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`
  Parameters:
    `level` -
    `message` -

### 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`
  Parameters:
    `level` -
    `message` -
    `t` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2010 Apache Software Foundation. All Rights Reserved.