org.apache.wink.logging
Class WinkLogHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.apache.wink.logging.WinkLogHandler

public class WinkLogHandler
extends java.util.logging.Handler


Nested Class Summary
static class WinkLogHandler.LEVEL
           
 
Constructor Summary
WinkLogHandler()
           
 
Method Summary
static void clearRecords()
          Clear all logRecords from the captured list.
 void close()
           
 void flush()
           
static java.util.logging.Level getLogLevel()
           
static java.util.List<java.util.logging.LogRecord> getRecords()
          get all captured LogRecords.
static java.util.List<java.util.logging.LogRecord> getRecordsFilteredBy(java.lang.String logName)
          Get only the records associated with the logger for a particular name.
 void publish(java.util.logging.LogRecord record)
           
static void turnLoggingCaptureOff()
          turns logging capture off
static void turnLoggingCaptureOn(WinkLogHandler.LEVEL _level)
          turns logging capture on
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WinkLogHandler

public WinkLogHandler()
Method Detail

close

public void close()
           throws java.lang.SecurityException
Specified by:
close in class java.util.logging.Handler
Throws:
java.lang.SecurityException

flush

public void flush()
Specified by:
flush in class java.util.logging.Handler

getLogLevel

public static java.util.logging.Level getLogLevel()

publish

public void publish(java.util.logging.LogRecord record)
Specified by:
publish in class java.util.logging.Handler

turnLoggingCaptureOn

public static void turnLoggingCaptureOn(WinkLogHandler.LEVEL _level)
turns logging capture on


turnLoggingCaptureOff

public static void turnLoggingCaptureOff()
turns logging capture off


getRecords

public static java.util.List<java.util.logging.LogRecord> getRecords()
get all captured LogRecords. It is recommended that you inspect the returned list, perform the desired asserts, then call clearRecords to clean up the list prior to the next test that may wish to also capture logging.

Returns:
ArrayList of LogRecords captured

getRecordsFilteredBy

public static java.util.List<java.util.logging.LogRecord> getRecordsFilteredBy(java.lang.String logName)
Get only the records associated with the logger for a particular name. Typically, this will be the class name of the production class under test.

Parameters:
logName -
Returns:
filtered ArrayList of LogRecords captured

clearRecords

public static void clearRecords()
Clear all logRecords from the captured list. It is recommended that test methods do this to clean up prior to the next test that may wish to also capture logging.



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