org.apache.velocity.runtime.log
Class Log4JLogChute

java.lang.Object
  extended byorg.apache.velocity.runtime.log.Log4JLogChute
All Implemented Interfaces:
LogChute
Direct Known Subclasses:
Log4JLogSystem

public class Log4JLogChute
extends Object
implements LogChute

Implementation of a simple log4j system that will either latch onto an existing category, or just do a simple rolling file log. Use this one rather than SimpleLog4JLogSystem; it uses the modern Logger concept of Log4J, rather than the deprecated Category concept.

Since:
Velocity 1.5
Version:
$Id: Log4JLogChute.java 440683 2006-09-06 10:55:36Z henning $
Author:
Daniel L. Rall,
Field Summary
protected  org.apache.log4j.Logger logger
          Log4J logging API.
static String RUNTIME_LOG_LOG4J_LOGGER
           
 
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
Log4JLogChute()
           
 
Method Summary
protected  void finalize()
          Also do a shutdown if the object is destroy()'d.
 void init(RuntimeServices rs)
          Initializes this LogChute.
 boolean isLevelEnabled(int level)
          Checks whether the logger is enabled for the specified level
 void log(int level, String message)
          logs messages
 void log(int level, String message, Throwable t)
          Send a log message from Velocity along with an exception or error
 void shutdown()
          Close all destinations
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RUNTIME_LOG_LOG4J_LOGGER

public static final String RUNTIME_LOG_LOG4J_LOGGER
See Also:
Constant Field Values

logger

protected org.apache.log4j.Logger logger
Log4J logging API.

Constructor Detail

Log4JLogChute

public Log4JLogChute()
Method Detail

init

public void init(RuntimeServices rs)
          throws Exception
Description copied from interface: LogChute
Initializes this LogChute.

Specified by:
init in interface LogChute
Throws:
Exception

log

public void log(int level,
                String message)
logs messages

Specified by:
log in interface LogChute
Parameters:
level - severity level
message - complete error message

log

public void log(int level,
                String message,
                Throwable t)
Send a log message from Velocity along with an exception or error

Specified by:
log in interface LogChute

isLevelEnabled

public boolean isLevelEnabled(int level)
Checks whether the logger is enabled for the specified level

Specified by:
isLevelEnabled in interface LogChute

finalize

protected void finalize()
                 throws Throwable
Also do a shutdown if the object is destroy()'d.

Throws:
Throwable

shutdown

public void shutdown()
Close all destinations



Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.