org.apache.jetspeed.webapp.logging.velocity
Class CommonsLoggingLog4JLogSystem
java.lang.Object
org.apache.jetspeed.webapp.logging.velocity.CommonsLoggingLog4JLogSystem
- All Implemented Interfaces:
- org.apache.velocity.runtime.log.LogSystem
public class CommonsLoggingLog4JLogSystem
- extends Object
- implements org.apache.velocity.runtime.log.LogSystem
Implementation of a LogSystem using Commons Logging to route Velocity message
through a IsolatedLog4JLogger setup.
Configure the following in your velocity.properties:
- runtime.log.logsystem.class=org.apache.jetspeed.webapp.logging.velocity.CommonsLoggingLog4JLogSystem
- runtime.log.logsystem.log4j.category=<a Log4J Category name to capture Velocity message, default value: "velocity">
For further information about setting up and configuring velocity:
Velocity - Developer's Guide
If you want to use a VelocityEngine instantiated by Spring using its org.springframework.ui.velocity.VelocityEngineFactoryBean
then you can also configure the above properties inline in its defintion or point it to your velocity.properties file.
But, beware of the following: the VelocityEngineFactoryBean by default overrides logging any configuration and hooks up their own
CommonsLoggingLogSystem. Which works fine just as this one, but uses as (hard coded) logging category the VelocityEngine class name.
So, if you do want to route your Velocity logging using your own category (or our default "velocity"), then you need to override the
VelocityEngineFactoryBean default logging setup by setting its "overrideLogging" property to false.
- Version:
- $Id$
- Author:
- Ate Douma
Fields inherited from interface org.apache.velocity.runtime.log.LogSystem |
DEBUG_ID, DEBUG_ON, ERROR_ID, INFO_ID, WARN_ID |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_CATEGORY
public static final String DEFAULT_CATEGORY
- See Also:
- Constant Field Values
logger
private org.apache.commons.logging.Log logger
CommonsLoggingLog4JLogSystem
public CommonsLoggingLog4JLogSystem()
init
public void init(org.apache.velocity.runtime.RuntimeServices rs)
throws Exception
- Specified by:
init
in interface org.apache.velocity.runtime.log.LogSystem
- Throws:
Exception
logVelocityMessage
public void logVelocityMessage(int level,
String message)
- Specified by:
logVelocityMessage
in interface org.apache.velocity.runtime.log.LogSystem
Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.