Package org.apache.log.format
Class ExtendedPatternFormatter
java.lang.Object
org.apache.log.format.PatternFormatter
org.apache.log.format.ExtendedPatternFormatter
- All Implemented Interfaces:
Formatter
Formatter especially designed for debugging applications.
This formatter extends the standard PatternFormatter to add
two new possible expansions. These expansions are %{method}
and %{thread}. In both cases the context map is first checked
for values with specified key. This is to facilitate passing
information about caller/thread when threads change (as in
AsyncLogTarget). They then attempt to determine appropriate
information dynamically.
- Version:
- $Id: ExtendedPatternFormatter.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team, Peter Donald
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.log.format.PatternFormatter
PatternFormatter.PatternRun
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private static final int
private static final String
private static final int
private static final String
Fields inherited from class org.apache.log.format.PatternFormatter
MAX_TYPE
-
Constructor Summary
ConstructorsConstructorDescriptionExtendedPatternFormatter
(String format) Creation of a new extended pattern formatter.ExtendedPatternFormatter
(String format, int callStackOffset) Creation of a new extended pattern formatter. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
formatPatternRun
(LogEvent event, PatternFormatter.PatternRun run) Formats a single pattern run (can be extended in subclasses).private String
Utility method to format category.private String
Utility thread to format category.protected int
getTypeIdFor
(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, getStackTrace, getThread, getTime, parse
-
Field Details
-
TYPE_METHOD
private static final int TYPE_METHOD- See Also:
-
TYPE_THREAD
private static final int TYPE_THREAD- See Also:
-
TYPE_METHOD_STR
- See Also:
-
TYPE_THREAD_STR
- See Also:
-
m_callStackOffset
private int m_callStackOffset
-
-
Constructor Details
-
ExtendedPatternFormatter
Creation of a new extended pattern formatter.- Parameters:
format
- the format string
-
ExtendedPatternFormatter
Creation of a new extended pattern formatter.- Parameters:
format
- the format stringcallStackOffset
- the offset
-
-
Method Details
-
getTypeIdFor
Retrieve the type-id for a particular string.- Overrides:
getTypeIdFor
in classPatternFormatter
- Parameters:
type
- the string- Returns:
- the type-id
-
formatPatternRun
Formats a single pattern run (can be extended in subclasses).- Overrides:
formatPatternRun
in classPatternFormatter
- Parameters:
event
- the log eventrun
- the pattern run to format.- Returns:
- the formatted result.
-
getMethod
Utility method to format category.- Parameters:
event
- the event- Returns:
- the formatted string
-
getThread
Utility thread to format category.- Parameters:
event
- the even- Returns:
- the formatted string
-