org.apache.avalon.framework.logger
Class AvalonFormatter
java.lang.Object
org.apache.log.format.PatternFormatter
org.apache.log.format.ExtendedPatternFormatter
org.apache.avalon.framework.logger.AvalonFormatter
- All Implemented Interfaces:
- Formatter, Formatter
- public class AvalonFormatter
- extends 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 optional short subformat 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 with AsyncLogTarget.
- Version:
- CVS $Revision: 1.27 $ $Date: 2003/02/11 16:25:49 $
- Author:
| Constructor Summary |
AvalonFormatter(java.lang.String pattern)
Construct the formatter with the specified pattern and which which prints out exceptions to stackDepth of 8. |
AvalonFormatter(java.lang.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 java.lang.String |
formatPatternRun(LogEvent event, PatternFormatter.PatternRun run)
Return the result of formaltting a pattern run. |
private java.lang.String |
getClass(java.lang.String format)
Finds the class that has called Logger. |
protected java.lang.String |
getStackTrace(java.lang.Throwable throwable, java.lang.String format)
Utility method to format stack trace. |
protected int |
getTypeIdFor(java.lang.String type)
Retrieve the type-id for a particular string. |
| Methods inherited from class org.apache.log.format.PatternFormatter |
format, getCategory, getContext, getContextMap, getContextStack, getMessage, getPriority, getRTime, getThread, getTime, parse, setFormat |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TYPE_CLASS
private static final int TYPE_CLASS
-
- See Also:
- Constant Field Values
TYPE_CLASS_STR
private static final java.lang.String TYPE_CLASS_STR
-
- See Also:
- Constant Field Values
TYPE_CLASS_SHORT_STR
private static final java.lang.String TYPE_CLASS_SHORT_STR
-
- See Also:
- Constant Field Values
DEFAULT_STACK_DEPTH
public static final int DEFAULT_STACK_DEPTH
-
The constant defining the default stack depth when none other is specified.
- Since:
- 4.1.2
- See Also:
- Constant Field Values
DEFAULT_PRINT_CASCADING
public static final boolean DEFAULT_PRINT_CASCADING
-
The constant defining the default behaviour for printing nested exceptions.
- Since:
- 4.1.2
- See Also:
- Constant Field Values
m_stackDepth
private final int m_stackDepth
-
m_printCascading
private final boolean m_printCascading
-
AvalonFormatter
public AvalonFormatter(java.lang.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(java.lang.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
getStackTrace
protected java.lang.String getStackTrace(java.lang.Throwable throwable,
java.lang.String format)
-
Utility method to format stack trace.
-
- Overrides:
getStackTrace in class PatternFormatter
-
- Parameters:
throwable - the throwable instance
format - ancilliary format parameter - allowed to be null
- Returns:
- the formatted string
getTypeIdFor
protected int getTypeIdFor(java.lang.String type)
-
Retrieve the type-id for a particular string.
-
- Overrides:
getTypeIdFor in class ExtendedPatternFormatter
-
- Parameters:
type - the string
- Returns:
- the type-id
formatPatternRun
protected java.lang.String formatPatternRun(LogEvent event,
PatternFormatter.PatternRun run)
-
Return the result of formaltting a pattern run.
-
- Overrides:
formatPatternRun in class ExtendedPatternFormatter
-
- Parameters:
event - the log event
run - the patter formatter pattern run
- Returns:
- the formatted string
getClass
private java.lang.String getClass(java.lang.String format)
-
Finds the class that has called Logger.
-
Please see keelframework.org for information about new Keel releases.