Top Description Fields Constructors Methods
org.apache.avalon.framework.logger

public Class AvalonFormatter

extends ExtendedPatternFormatter
Class Inheritance
Imports
org.apache.avalon.framework.ExceptionUtil, org.apache.log.LogEvent, org.apache.log.format.ExtendedPatternFormatter, .PatternFormatter, org.apache.log.util.StackIntrospector

This formatter extends ExtendedPatternFormatter so that CascadingExceptions are formatted with all nested exceptions.
Author
Avalon Development Team
Version
$Id: AvalonFormatter.java 506231 2007-02-12 02:36:54Z crossley $

Field Summary

Modifier and TypeField and Description
public static final boolean
DEFAULT_PRINT_CASCADING

The constant defining the default behaviour for printing nested exceptions.

public static final int
DEFAULT_STACK_DEPTH

The constant defining the default stack depth when none other is specified.

private final boolean
private final int
private static final int
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public
AvalonFormatter(final String
The pattern to use to format the log entries
pattern
)

Construct the formatter with the specified pattern and which which prints out exceptions to stackDepth of 8.

public
AvalonFormatter(final String
The pattern to use to format the log entries
pattern
,
final int
The depth to which stacktraces are printed out
stackDepth
,
final boolean
true enables printing of nested exceptions, false only prints out the outermost exception
printCascading
)

Construct the formatter with the specified pattern and which which prints out exceptions to stackDepth specified.

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

the formatted string
formatPatternRun
(LogEvent
the log event
event
,
PatternFormatter.PatternRun
the patter formatter pattern run
run
)

Overrides org.apache.log.format.ExtendedPatternFormatter.formatPatternRun.

Return the result of formaltting a pattern run.
private String
getClass(String format)

Finds the class that has called Logger.

protected String

Returns:

the formatted string
getStackTrace
(final Throwable
the throwable instance
throwable
,
final String
ancilliary format parameter - allowed to be null
format
)

Overrides org.apache.log.format.PatternFormatter.getStackTrace.

Utility method to format stack trace.
protected int

Returns:

the type-id
getTypeIdFor
(final String
the string
type
)

Overrides org.apache.log.format.ExtendedPatternFormatter.getTypeIdFor.

Retrieve the type-id for a particular string.

Field Detail

DEFAULT_PRINT_CASCADINGback to summary
public static final boolean DEFAULT_PRINT_CASCADING

The constant defining the default behaviour for printing nested exceptions.

Since
4.1.2
DEFAULT_STACK_DEPTHback to summary
public static final int DEFAULT_STACK_DEPTH

The constant defining the default stack depth when none other is specified.

Since
4.1.2
m_printCascadingback to summary
private final boolean m_printCascading
m_stackDepthback to summary
private final int m_stackDepth
TYPE_CLASSback to summary
private static final int TYPE_CLASS
TYPE_CLASS_SHORT_STRback to summary
private static final String TYPE_CLASS_SHORT_STR
TYPE_CLASS_STRback to summary
private static final String TYPE_CLASS_STR

Constructor Detail

AvalonFormatterback to summary
public AvalonFormatter(final String pattern)

Construct the formatter with the specified pattern and which which prints out exceptions to stackDepth of 8.

Parameters
pattern:String

The pattern to use to format the log entries

Since
4.1
AvalonFormatterback to summary
public AvalonFormatter(final String pattern, final int stackDepth, final boolean printCascading)

Construct the formatter with the specified pattern and which which prints out exceptions to stackDepth specified.

Parameters
pattern:String

The pattern to use to format the log entries

stackDepth:int

The depth to which stacktraces are printed out

printCascading:boolean

true enables printing of nested exceptions, false only prints out the outermost exception

Since
4.1.2

Method Detail

formatPatternRunback to summary
protected String formatPatternRun(LogEvent event, PatternFormatter.PatternRun run)

Overrides org.apache.log.format.ExtendedPatternFormatter.formatPatternRun.

Return the result of formaltting a pattern run.

Parameters
event:LogEvent

the log event

run:PatternFormatter.PatternRun

the patter formatter pattern run

Returns:String

the formatted string

getClassback to summary
private String getClass(String format)

Finds the class that has called Logger.

getStackTraceback to summary
protected String getStackTrace(final Throwable throwable, final String format)

Overrides org.apache.log.format.PatternFormatter.getStackTrace.

Utility method to format stack trace.

Parameters
throwable:Throwable

the throwable instance

format:String

ancilliary format parameter - allowed to be null

Returns:String

the formatted string

getTypeIdForback to summary
protected int getTypeIdFor(final String type)

Overrides org.apache.log.format.ExtendedPatternFormatter.getTypeIdFor.

Retrieve the type-id for a particular string.

Parameters
type:String

the string

Returns:int

the type-id