org.apache.avalon.framework.logger

Class AvalonFormatter


public class AvalonFormatter
extends ExtendedPatternFormatter

This formatter extends ExtendedPatternFormatter so that CascadingExceptions are formatted with all nested exceptions.
Version:
CVS $Revision: 1.29 $ $Date: 2004/02/11 14:34:26 $
Author:
Avalon Development Team

Field Summary

static boolean
DEFAULT_PRINT_CASCADING
The constant defining the default behaviour for printing nested exceptions.
static int
DEFAULT_STACK_DEPTH
The constant defining the default stack depth when none other is specified.

Constructor Summary

AvalonFormatter(String pattern)
Construct the formatter with the specified pattern and which which prints out exceptions to stackDepth of 8.
AvalonFormatter(String pattern, int stackDepth, boolean printCascading)
Construct the formatter with the specified pattern and which which prints out exceptions to stackDepth specified.

Method Summary

protected String
formatPatternRun(LogEvent event, PatternFormatter.PatternRun run)
Return the result of formaltting a pattern run.
protected String
getStackTrace(Throwable throwable, String format)
Utility method to format stack trace.
protected int
getTypeIdFor(String type)
Retrieve the type-id for a particular string.

Field Details

DEFAULT_PRINT_CASCADING

public static final boolean DEFAULT_PRINT_CASCADING
The constant defining the default behaviour for printing nested exceptions.
Field Value:
true
Since:
4.1.2

DEFAULT_STACK_DEPTH

public static final int DEFAULT_STACK_DEPTH
The constant defining the default stack depth when none other is specified.
Field Value:
8
Since:
4.1.2

Constructor Details

AvalonFormatter

public AvalonFormatter(String pattern)
Construct the formatter with the specified pattern and which which prints out exceptions to stackDepth of 8.
Parameters:
pattern - The pattern to use to format the log entries
Since:
4.1

AvalonFormatter

public AvalonFormatter(String pattern,
                       int stackDepth,
                       boolean printCascading)
Construct the formatter with the specified pattern and which which prints out exceptions to stackDepth specified.
Parameters:
pattern - The pattern to use to format the log entries
stackDepth - The depth to which stacktraces are printed out
printCascading - true enables printing of nested exceptions, false only prints out the outermost exception
Since:
4.1.2

Method Details

formatPatternRun

protected String formatPatternRun(LogEvent event,
                                  PatternFormatter.PatternRun run)
Return the result of formaltting a pattern run.
Parameters:
event - the log event
run - the patter formatter pattern run
Returns:
the formatted string

getStackTrace

protected String getStackTrace(Throwable throwable,
                               String format)
Utility method to format stack trace.
Parameters:
throwable - the throwable instance
format - ancilliary format parameter - allowed to be null
Returns:
the formatted string

getTypeIdFor

protected int getTypeIdFor(String type)
Retrieve the type-id for a particular string.
Parameters:
type - the string
Returns:
the type-id