org.apache.cocoon.util.log
Class CocoonLogFormatter
java.lang.Object
|
+--org.apache.cocoon.util.log.ExtensiblePatternFormatter
|
+--org.apache.cocoon.util.log.CocoonLogFormatter
- All Implemented Interfaces:
- org.apache.log.format.Formatter
- public class CocoonLogFormatter
- extends ExtensiblePatternFormatter
An extended pattern formatter. New patterns are defined by this class are :
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
.
thread
: outputs the name of the current thread (first element
on the context stack).
uri
: outputs the request URI.-
- Version:
- CVS $Id: CocoonLogFormatter.java,v 1.5.2.1 2002/06/26 22:25:55 vgritsenko Exp $
- Author:
- Sylvain Wallez
Fields inherited from class org.apache.cocoon.util.log.ExtensiblePatternFormatter |
EOL, m_formatSpecification, MAX_TYPE, SPACE_1, SPACE_16, SPACE_2, SPACE_4, SPACE_8, TYPE_CATEGORY, TYPE_CATEGORY_STR, TYPE_MESSAGE, TYPE_MESSAGE_STR, TYPE_PRIORITY, TYPE_PRIORITY_STR, TYPE_RELATIVE_TIME, TYPE_RELATIVE_TIME_STR, TYPE_TEXT, TYPE_THROWABLE, TYPE_THROWABLE_STR, TYPE_TIME, TYPE_TIME_STR |
Method Summary |
protected java.lang.String |
formatPatternRun(org.apache.log.LogEvent event,
ExtensiblePatternFormatter.PatternRun run)
Formats a single pattern run (can be extended in subclasses). |
protected java.lang.String |
getStackTrace(java.lang.Throwable throwable,
java.lang.String format)
Utility method to format stack trace so that CascadingExceptions are
formatted with all nested exceptions.
|
protected java.lang.String |
getTime(long time,
java.lang.String format)
Utility method to format time. |
protected int |
getTypeIdFor(java.lang.String type)
Retrieve the type-id for a particular string. |
Methods inherited from class org.apache.cocoon.util.log.ExtensiblePatternFormatter |
addPatternRun, addTextRun, append, appendWhiteSpace, fix, format, getCategory, getMessage, getPriority, parse, setFormat |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TYPE_CLASS
protected static final int TYPE_CLASS
TYPE_URI
protected static final int TYPE_URI
TYPE_THREAD
protected static final int TYPE_THREAD
TYPE_CLASS_STR
protected static final java.lang.String TYPE_CLASS_STR
TYPE_CLASS_SHORT_STR
protected static final java.lang.String TYPE_CLASS_SHORT_STR
TYPE_URI_STR
protected static final java.lang.String TYPE_URI_STR
TYPE_THREAD_STR
protected static final java.lang.String TYPE_THREAD_STR
dateFormatter
protected final java.text.SimpleDateFormat dateFormatter
CocoonLogFormatter
public CocoonLogFormatter()
getTypeIdFor
protected int getTypeIdFor(java.lang.String type)
- Description copied from class:
ExtensiblePatternFormatter
- Retrieve the type-id for a particular string.
- Overrides:
getTypeIdFor
in class ExtensiblePatternFormatter
- Following copied from class:
org.apache.cocoon.util.log.ExtensiblePatternFormatter
- Parameters:
type
- the string- Returns:
- the type-id
formatPatternRun
protected java.lang.String formatPatternRun(org.apache.log.LogEvent event,
ExtensiblePatternFormatter.PatternRun run)
- Description copied from class:
ExtensiblePatternFormatter
- Formats a single pattern run (can be extended in subclasses).
- Overrides:
formatPatternRun
in class ExtensiblePatternFormatter
- Following copied from class:
org.apache.cocoon.util.log.ExtensiblePatternFormatter
- Parameters:
run
- the pattern run to format.- Returns:
- the formatted result.
getStackTrace
protected java.lang.String getStackTrace(java.lang.Throwable throwable,
java.lang.String format)
- Utility method to format stack trace so that CascadingExceptions are
formatted with all nested exceptions.
FIXME : copied from AvalonFormatter, to be removed if ExtensiblePatternFormatter
replaces PatternFormatter.
- Overrides:
getStackTrace
in class ExtensiblePatternFormatter
- Parameters:
throwable
- the throwable instanceformat
- ancilliary format parameter - allowed to be null- Returns:
- the formatted string
getTime
protected java.lang.String getTime(long time,
java.lang.String format)
- Utility method to format time.
- Overrides:
getTime
in class ExtensiblePatternFormatter
- Parameters:
time
- the timeformat
- ancilliary format parameter - allowed to be null- Returns:
- the formatted string
Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.