|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.util.log.ExtensiblePatternFormatter
public class ExtensiblePatternFormatter
A refactoring of org.apache.log.format.PatternFormatter
that
can be extended.
This formater formats the LogEntries according to a input pattern string.
The format of each pattern element can be %[+|-]#.#{field:subformat}
The +|- indicates left or right justify.
The #.# indicates the minimum and maximum size of output.
'field' indicates which field is to be output and must be one of
properties of LogEvent
'subformat' indicates a particular subformat and is currently unused.
Nested Class Summary | |
---|---|
protected static class |
ExtensiblePatternFormatter.PatternRun
Deprecated. |
Field Summary | |
---|---|
protected ExtensiblePatternFormatter.PatternRun[] |
m_formatSpecification
Deprecated. |
protected static int |
MAX_TYPE
Deprecated. The maximum value used for TYPEs. |
protected static int |
TYPE_CATEGORY
Deprecated. |
protected static String |
TYPE_CATEGORY_STR
Deprecated. |
protected static int |
TYPE_MESSAGE
Deprecated. |
protected static String |
TYPE_MESSAGE_STR
Deprecated. |
protected static int |
TYPE_PRIORITY
Deprecated. |
protected static String |
TYPE_PRIORITY_STR
Deprecated. |
protected static int |
TYPE_RELATIVE_TIME
Deprecated. |
protected static String |
TYPE_RELATIVE_TIME_STR
Deprecated. |
protected static int |
TYPE_TEXT
Deprecated. |
protected static int |
TYPE_THROWABLE
Deprecated. |
protected static String |
TYPE_THROWABLE_STR
Deprecated. |
protected static int |
TYPE_TIME
Deprecated. |
protected static String |
TYPE_TIME_STR
Deprecated. |
Constructor Summary | |
---|---|
ExtensiblePatternFormatter()
Deprecated. |
Method Summary | |
---|---|
protected int |
addPatternRun(Stack stack,
char[] pattern,
int index)
Deprecated. Extract and build a pattern from input string. |
protected int |
addTextRun(Stack stack,
char[] pattern,
int index)
Deprecated. Extract and build a text run from input string. |
protected void |
append(StringBuffer sb,
int minSize,
int maxSize,
boolean rightJustify,
String output)
Deprecated. Utility to append a string to buffer given certain constraints. |
protected String |
fix(String context)
Deprecated. Correct a context string by replacing '.'' |
String |
format(LogEvent event)
Deprecated. Format the event according to the pattern. |
protected String |
formatPatternRun(LogEvent event,
ExtensiblePatternFormatter.PatternRun run)
Deprecated. Formats a single pattern run (can be extended in subclasses). |
protected String |
getCategory(String category,
String format)
Deprecated. Utility method to format category. |
protected String |
getMessage(String message,
String format)
Deprecated. Utility method to format message. |
protected String |
getPriority(Priority priority,
String format)
Deprecated. Get formatted priority string. |
protected String |
getStackTrace(Throwable throwable,
String format)
Deprecated. Utility method to format stack trace. |
protected String |
getTime(long time,
String format)
Deprecated. Utility method to format time. |
protected int |
getTypeIdFor(String type)
Deprecated. Retrieve the type-id for a particular string. |
protected void |
parse(String patternString)
Deprecated. Parse the input pattern and build internal data structures. |
void |
setFormat(String format)
Deprecated. Set the string description that the format is extracted from. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int TYPE_TEXT
protected static final int TYPE_CATEGORY
protected static final int TYPE_MESSAGE
protected static final int TYPE_TIME
protected static final int TYPE_RELATIVE_TIME
protected static final int TYPE_THROWABLE
protected static final int TYPE_PRIORITY
protected static final int MAX_TYPE
MAX_TYPE + 1
.
protected static final String TYPE_CATEGORY_STR
protected static final String TYPE_MESSAGE_STR
protected static final String TYPE_TIME_STR
protected static final String TYPE_RELATIVE_TIME_STR
protected static final String TYPE_THROWABLE_STR
protected static final String TYPE_PRIORITY_STR
protected ExtensiblePatternFormatter.PatternRun[] m_formatSpecification
Constructor Detail |
---|
public ExtensiblePatternFormatter()
Method Detail |
---|
protected int addPatternRun(Stack stack, char[] pattern, int index)
stack
- the stack on which to place patternspattern
- the input stringindex
- the start of pattern run
protected int addTextRun(Stack stack, char[] pattern, int index)
stack
- the stack on which to place runspattern
- the input stringindex
- the start of the text run
protected void append(StringBuffer sb, int minSize, int maxSize, boolean rightJustify, String output)
sb
- the StringBufferminSize
- the minimum size of output (0 to ignore)maxSize
- the maximum size of output (0 to ignore)rightJustify
- true if the string is to be right justified in it's box.output
- the input stringpublic String format(LogEvent event)
format
in interface Formatter
event
- the event
protected String formatPatternRun(LogEvent event, ExtensiblePatternFormatter.PatternRun run)
run
- the pattern run to format.
protected String getCategory(String category, String format)
category
- the category stringformat
- ancilliary format parameter - allowed to be null
protected String getPriority(Priority priority, String format)
protected final String fix(String context)
context
- the un-fixed context
protected String getMessage(String message, String format)
message
- the message stringformat
- ancilliary format parameter - allowed to be null
protected String getStackTrace(Throwable throwable, String format)
throwable
- the throwable instanceformat
- ancilliary format parameter - allowed to be null
protected String getTime(long time, String format)
time
- the timeformat
- ancilliary format parameter - allowed to be null
protected int getTypeIdFor(String type)
type
- the string
protected void parse(String patternString)
patternString
- the patternpublic void setFormat(String format)
format
- the string format
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |