Package org.apache.velocity.runtime.log
Class CommonsLogLogChute
- java.lang.Object
-
- org.apache.velocity.runtime.log.CommonsLogLogChute
-
- All Implemented Interfaces:
LogChute
public class CommonsLogLogChute extends java.lang.Object implements LogChute
Redirects Velocity's LogChute messages to commons-logging.To use, first set up commons-logging, then tell Velocity to use this class for logging by adding the following to your velocity.properties:
runtime.log.logsystem.class = org.apache.velocity.runtime.log.CommonsLogLogChuteYou may also set this property to specify what log/name Velocity's messages should be logged to (example below is default).
runtime.log.logsystem.commons.logging.name = org.apache.velocity- Since:
- 1.6
- Version:
- $Id: CommonsLogLogChute.java 71982 2004-02-18 20:11:07Z nbubna $
- Author:
- Nathan Bubna
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_LOG_NAMEDefault name for the commons-logging instanceprotected org.apache.commons.logging.Loglogthe commons-logging Log instancestatic java.lang.StringLOGCHUTE_COMMONS_LOG_NAMEProperty key for specifying the name for the log instance-
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 CommonsLogLogChute()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit(RuntimeServices rs)LogChute methodsbooleanisLevelEnabled(int level)Checks whether the specified log level is enabled.voidlog(int level, java.lang.String message)Send a log message from Velocity.voidlog(int level, java.lang.String message, java.lang.Throwable t)Send a log message from Velocity with an error.
-
-
-
Field Detail
-
LOGCHUTE_COMMONS_LOG_NAME
public static final java.lang.String LOGCHUTE_COMMONS_LOG_NAME
Property key for specifying the name for the log instance- See Also:
- Constant Field Values
-
DEFAULT_LOG_NAME
public static final java.lang.String DEFAULT_LOG_NAME
Default name for the commons-logging instance- See Also:
- Constant Field Values
-
log
protected org.apache.commons.logging.Log log
the commons-logging Log instance
-
-
Method Detail
-
init
public void init(RuntimeServices rs) throws java.lang.Exception
LogChute methods
-
log
public void log(int level, java.lang.String message)Send a log message from Velocity.
-
log
public void log(int level, java.lang.String message, java.lang.Throwable t)Send a log message from Velocity with an error.
-
isLevelEnabled
public boolean isLevelEnabled(int level)
Checks whether the specified log level is enabled.- Specified by:
isLevelEnabledin interfaceLogChute- Returns:
- True if a level is enabled.
-
-