edu.internet2.middleware.shibboleth.common.util
Class Slf4JLogChute

java.lang.Object
  extended by edu.internet2.middleware.shibboleth.common.util.Slf4JLogChute
All Implemented Interfaces:
org.apache.velocity.runtime.log.LogChute

public class Slf4JLogChute
extends Object
implements org.apache.velocity.runtime.log.LogChute

Redirects Velocity's LogChute messages to SLF4J.

To use, first set up SLF4J, then tell Velocity to use this class for logging by adding the following to your velocity.properties: runtime.log.logsystem.class = edu.internet2.middleware.shibboleth.common.util.Slf4jLogChute

You may also set this property to specify what log/name Velocity's messages should be logged to (example below is default). runtime.log.logsystem.slf4j.name = org.apache.velocity


Field Summary
static String DEFAULT_LOG_NAME
          Default name for the commons-logging instance
protected  org.slf4j.Logger log
          The Slf4J Logger instance.
static String LOGCHUTE_SLF4J_NAME
          Property 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
Slf4JLogChute()
           
 
Method Summary
 void init(org.apache.velocity.runtime.RuntimeServices rs)
          
 boolean isLevelEnabled(int level)
          
 void log(int level, String message)
          
 void log(int level, String message, Throwable t)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGCHUTE_SLF4J_NAME

public static final String LOGCHUTE_SLF4J_NAME
Property key for specifying the name for the log instance

See Also:
Constant Field Values

DEFAULT_LOG_NAME

public static final String DEFAULT_LOG_NAME
Default name for the commons-logging instance

See Also:
Constant Field Values

log

protected org.slf4j.Logger log
The Slf4J Logger instance.

Constructor Detail

Slf4JLogChute

public Slf4JLogChute()
Method Detail

init

public void init(org.apache.velocity.runtime.RuntimeServices rs)
          throws Exception

Specified by:
init in interface org.apache.velocity.runtime.log.LogChute
Throws:
Exception

isLevelEnabled

public boolean isLevelEnabled(int level)

Specified by:
isLevelEnabled in interface org.apache.velocity.runtime.log.LogChute

log

public void log(int level,
                String message)

Specified by:
log in interface org.apache.velocity.runtime.log.LogChute

log

public void log(int level,
                String message,
                Throwable t)

Specified by:
log in interface org.apache.velocity.runtime.log.LogChute


Copyright © 1999-2012. All Rights Reserved.