Class AvalonFormatter
java.lang.Object
org.apache.log.format.PatternFormatter
org.apache.log.format.ExtendedPatternFormatter
org.apache.avalon.framework.logger.AvalonFormatter
- All Implemented Interfaces:
org.apache.log.format.Formatter
public class AvalonFormatter
extends org.apache.log.format.ExtendedPatternFormatter
This formatter extends ExtendedPatternFormatter so that
CascadingExceptions are formatted with all nested exceptions.
class: outputs the name of the class that has logged the message. The optionalshortsubformat removes the package name. Warning : this pattern works only if formatting occurs in the same thread as the call to Logger, i.e. it won't work withAsyncLogTarget.
- Version:
- CVS $Revision: 1.29 $ $Date: 2004/02/11 14:34:26 $
- Author:
- Avalon Development Team
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.log.format.PatternFormatter
org.apache.log.format.PatternFormatter.PatternRun -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe constant defining the default behaviour for printing nested exceptions.static final intThe constant defining the default stack depth when none other is specified.Fields inherited from class org.apache.log.format.PatternFormatter
MAX_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionAvalonFormatter(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
Modifier and TypeMethodDescriptionprotected StringformatPatternRun(org.apache.log.LogEvent event, org.apache.log.format.PatternFormatter.PatternRun run) Return the result of formaltting a pattern run.protected StringgetStackTrace(Throwable throwable, String format) Utility method to format stack trace.protected intgetTypeIdFor(String type) Retrieve the type-id for a particular string.Methods inherited from class org.apache.log.format.PatternFormatter
format, getCategory, getContextMap, getMessage, getPriority, getRTime, getThread, getTime, parse
-
Field Details
-
DEFAULT_STACK_DEPTH
public static final int DEFAULT_STACK_DEPTHThe constant defining the default stack depth when none other is specified.- Since:
- 4.1.2
- See Also:
-
DEFAULT_PRINT_CASCADING
public static final boolean DEFAULT_PRINT_CASCADINGThe constant defining the default behaviour for printing nested exceptions.- Since:
- 4.1.2
- See Also:
-
-
Constructor Details
-
AvalonFormatter
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
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 entriesstackDepth- The depth to which stacktraces are printed outprintCascading- true enables printing of nested exceptions, false only prints out the outermost exception- Since:
- 4.1.2
-
-
Method Details
-
getStackTrace
Utility method to format stack trace.- Overrides:
getStackTracein classorg.apache.log.format.PatternFormatter- Parameters:
throwable- the throwable instanceformat- ancilliary format parameter - allowed to be null- Returns:
- the formatted string
-
getTypeIdFor
Retrieve the type-id for a particular string.- Overrides:
getTypeIdForin classorg.apache.log.format.ExtendedPatternFormatter- Parameters:
type- the string- Returns:
- the type-id
-
formatPatternRun
protected String formatPatternRun(org.apache.log.LogEvent event, org.apache.log.format.PatternFormatter.PatternRun run) Return the result of formaltting a pattern run.- Overrides:
formatPatternRunin classorg.apache.log.format.ExtendedPatternFormatter- Parameters:
event- the log eventrun- the patter formatter pattern run- Returns:
- the formatted string
-