org.apache.velocity.test.misc
Class TestLogChute

java.lang.Object
  extended by org.apache.velocity.runtime.log.SystemLogChute
      extended by org.apache.velocity.test.misc.TestLogChute
All Implemented Interfaces:
org.apache.velocity.runtime.log.LogChute

public class TestLogChute
extends org.apache.velocity.runtime.log.SystemLogChute

LogChute implementation that can easily capture output or suppress it entirely. By default, both capture and suppress are on. To have this behave like a normal SystemLogChute, you must turn it on() and stopCapture().

Version:
$Id: TestLogChute.java 749684 2009-03-03 18:38:16Z nbubna $
Author:
Will Glass-Husain, Nathan Bubna

Field Summary
static String TEST_LOGGER_LEVEL
           
 
Fields inherited from class org.apache.velocity.runtime.log.SystemLogChute
RUNTIME_LOG_LEVEL_KEY, RUNTIME_LOG_SYSTEM_ERR_LEVEL_KEY
 
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
TestLogChute()
           
TestLogChute(boolean suppress, boolean capture)
           
 
Method Summary
 String getLog()
          Return the captured log messages to date.
 void init(org.apache.velocity.runtime.RuntimeServices rs)
           
 boolean isLevelEnabled(int level)
           
 void off()
           
 void on()
           
 void startCapture()
           
 void stopCapture()
           
protected  void write(PrintStream ps, String prefix, String message, Throwable t)
           
 
Methods inherited from class org.apache.velocity.runtime.log.SystemLogChute
getEnabledLevel, getPrefix, getSystemErrLevel, log, log, setEnabledLevel, setSystemErrLevel, toLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEST_LOGGER_LEVEL

public static final String TEST_LOGGER_LEVEL
See Also:
Constant Field Values
Constructor Detail

TestLogChute

public TestLogChute()

TestLogChute

public TestLogChute(boolean suppress,
                    boolean capture)
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
Overrides:
init in class org.apache.velocity.runtime.log.SystemLogChute
Throws:
Exception

on

public void on()

off

public void off()

startCapture

public void startCapture()

stopCapture

public void stopCapture()

isLevelEnabled

public boolean isLevelEnabled(int level)
Specified by:
isLevelEnabled in interface org.apache.velocity.runtime.log.LogChute
Overrides:
isLevelEnabled in class org.apache.velocity.runtime.log.SystemLogChute

write

protected void write(PrintStream ps,
                     String prefix,
                     String message,
                     Throwable t)
Overrides:
write in class org.apache.velocity.runtime.log.SystemLogChute

getLog

public String getLog()
Return the captured log messages to date.

Returns:
log messages


Copyright © 2000-2010 The Apache Software Foundation. All Rights Reserved.