Package org.apache.velocity.runtime.log
Class ServletLogChute
- java.lang.Object
-
- org.apache.velocity.runtime.log.ServletLogChute
-
- All Implemented Interfaces:
LogChute
public class ServletLogChute extends java.lang.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 Summary
Fields Modifier and Type Field Description static java.lang.String
PREFIX
static java.lang.String
RUNTIME_LOG_LEVEL_KEY
protected javax.servlet.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
Constructors Constructor Description ServletLogChute()
Construct a simple logger for a servlet environment.
-
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.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, java.lang.String message)
Send a log message from Velocity.void
log(int level, java.lang.String message, java.lang.Throwable t)
Send a log message from Velocity along with an exception or errorvoid
setEnabledLevel(int level)
Set the minimum level at which messages will be printed.protected int
toLevel(java.lang.String level)
-
-
-
Field Detail
-
RUNTIME_LOG_LEVEL_KEY
public static final java.lang.String RUNTIME_LOG_LEVEL_KEY
- See Also:
- Constant Field Values
-
servletContext
protected javax.servlet.ServletContext servletContext
-
PREFIX
public static final java.lang.String PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(RuntimeServices rs) throws java.lang.Exception
init()
-
toLevel
protected int toLevel(java.lang.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 interfaceLogChute
- Returns:
- True if a level is enabled.
-
log
public void log(int level, java.lang.String message)
Send a log message from Velocity.
-
-