uk.org.lidalia.sysoutslf4j.context.exceptionhandlers
Class LogPerLineExceptionHandlingStrategyFactory

java.lang.Object
  extended by uk.org.lidalia.sysoutslf4j.context.exceptionhandlers.LogPerLineExceptionHandlingStrategyFactory
All Implemented Interfaces:
ExceptionHandlingStrategyFactory

public final class LogPerLineExceptionHandlingStrategyFactory
extends Object
implements ExceptionHandlingStrategyFactory

Implementation of LogPerLineExceptionHandlingStrategyFactory which returns an ExceptionHandlingStrategy that simply logs each line of the stack trace as a separate logging event.


Method Summary
static ExceptionHandlingStrategyFactory getInstance()
           
 ExceptionHandlingStrategy makeExceptionHandlingStrategy(LogLevel logLevel, PrintStream originalPrintStream)
          This method will be called twice for each context that is sent to SLF4J, once each to return an ExceptionHandlingStrategy for the new System.out and System.err print streams.
It is called with the LogLevel of the SLF4JPrintStream and the original System output PrintStream that is being replaced, so that ExceptionHandlingStrategies can have direct access to the console if they wish.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ExceptionHandlingStrategyFactory getInstance()

makeExceptionHandlingStrategy

public ExceptionHandlingStrategy makeExceptionHandlingStrategy(LogLevel logLevel,
                                                               PrintStream originalPrintStream)
Description copied from interface: ExceptionHandlingStrategyFactory
This method will be called twice for each context that is sent to SLF4J, once each to return an ExceptionHandlingStrategy for the new System.out and System.err print streams.
It is called with the LogLevel of the SLF4JPrintStream and the original System output PrintStream that is being replaced, so that ExceptionHandlingStrategies can have direct access to the console if they wish.

Specified by:
makeExceptionHandlingStrategy in interface ExceptionHandlingStrategyFactory
Parameters:
logLevel - The LogLevel of the parent PrintStream (by default INFO for System.out and ERROR for System.err)
originalPrintStream - The original System output PrintStream providing direct access to the console
Returns:
an ExceptionHandlingStrategy that will be called with each line of an Exception that is printed using Throwable.printStacktrace() or Throwable.printStacktrace(System.out)


Copyright © 2010. All Rights Reserved.