Package org.apache.velocity.runtime.log
Class ServletLogChute
java.lang.Object
org.apache.velocity.runtime.log.ServletLogChute
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
protected javax.servlet.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 -
Method Summary
Modifier and TypeMethodDescriptionint
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
Send a log message from Velocity.void
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
-
Field Details
-
RUNTIME_LOG_LEVEL_KEY
- See Also:
-
servletContext
protected javax.servlet.ServletContext servletContext -
PREFIX
- See Also:
-
-
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
init()- Specified by:
init
in interfaceLogChute
- Throws:
IllegalStateException
- if the ServletContext is not available in the application attributes under the appropriate key.Exception
-
toLevel
-
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
Send a log message from Velocity. -
log
Description copied from interface:LogChute
Send a log message from Velocity along with an exception or error
-