org.apache.jetspeed.webapp.logging.velocity
Class CommonsLoggingLog4JLogSystem

java.lang.Object
  extended by org.apache.jetspeed.webapp.logging.velocity.CommonsLoggingLog4JLogSystem
All Implemented Interfaces:
org.apache.velocity.runtime.log.LogSystem

public class CommonsLoggingLog4JLogSystem
extends java.lang.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:

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

Field Summary
static java.lang.String DEFAULT_CATEGORY
           
 
Fields inherited from interface org.apache.velocity.runtime.log.LogSystem
DEBUG_ID, DEBUG_ON, ERROR_ID, INFO_ID, WARN_ID
 
Constructor Summary
CommonsLoggingLog4JLogSystem()
           
 
Method Summary
 void init(org.apache.velocity.runtime.RuntimeServices rs)
           
 void logVelocityMessage(int level, java.lang.String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CATEGORY

public static final java.lang.String DEFAULT_CATEGORY
See Also:
Constant Field Values
Constructor Detail

CommonsLoggingLog4JLogSystem

public CommonsLoggingLog4JLogSystem()
Method Detail

init

public void init(org.apache.velocity.runtime.RuntimeServices rs)
          throws java.lang.Exception
Specified by:
init in interface org.apache.velocity.runtime.log.LogSystem
Throws:
java.lang.Exception

logVelocityMessage

public void logVelocityMessage(int level,
                               java.lang.String message)
Specified by:
logVelocityMessage in interface org.apache.velocity.runtime.log.LogSystem


Copyright © 1999-2009 Apache Software Foundation. All Rights Reserved.