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 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
.
uri
: Outputs the request URI.
query
: Outputs the request query string
thread
: Outputs the name of the current thread (first element
on the context stack).
host
: Outputs the request host header.-
rootThrowable
: Outputs the root throwable message and
stacktrace.-
- Version:
- $Id: CocoonLogFormatter.java 326589 2005-10-19 15:55:45Z sylvain $
- Author:
- Sylvain Wallez, Vadim Gritsenko
Fields inherited from class org.apache.cocoon.util.log.ExtensiblePatternFormatter |
m_formatSpecification, MAX_TYPE, 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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_STACK_DEPTH
public static final int DEFAULT_STACK_DEPTH
- The constant defining the default stack depth when
none other is specified.
- See Also:
- Constant Field Values
TYPE_CLASS
protected static final int TYPE_CLASS
- See Also:
- Constant Field Values
TYPE_URI
protected static final int TYPE_URI
- See Also:
- Constant Field Values
TYPE_THREAD
protected static final int TYPE_THREAD
- See Also:
- Constant Field Values
TYPE_HOST
protected static final int TYPE_HOST
- See Also:
- Constant Field Values
TYPE_QUERY
protected static final int TYPE_QUERY
- See Also:
- Constant Field Values
TYPE_ROOTTHROWABLE
protected static final int TYPE_ROOTTHROWABLE
- See Also:
- Constant Field Values
TYPE_CLASS_STR
protected static final String TYPE_CLASS_STR
- See Also:
- Constant Field Values
TYPE_CLASS_SHORT_STR
protected static final String TYPE_CLASS_SHORT_STR
- See Also:
- Constant Field Values
TYPE_URI_STR
protected static final String TYPE_URI_STR
- See Also:
- Constant Field Values
TYPE_THREAD_STR
protected static final String TYPE_THREAD_STR
- See Also:
- Constant Field Values
TYPE_HOST_STR
protected static final String TYPE_HOST_STR
- See Also:
- Constant Field Values
TYPE_QUERY_STR
protected static final String TYPE_QUERY_STR
- See Also:
- Constant Field Values
TYPE_ROOTTHROWABLE_STR
protected static final String TYPE_ROOTTHROWABLE_STR
- See Also:
- Constant Field Values
CocoonLogFormatter
public CocoonLogFormatter()
CocoonLogFormatter
public CocoonLogFormatter(int stackDepth)
getTypeIdFor
protected int getTypeIdFor(String type)
- Description copied from class:
ExtensiblePatternFormatter
- Retrieve the type-id for a particular string.
- Overrides:
getTypeIdFor
in class ExtensiblePatternFormatter
- Parameters:
type
- the string
- Returns:
- the type-id
formatPatternRun
protected 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
- Parameters:
run
- the pattern run to format.
- Returns:
- the formatted result.
getStackTrace
protected String getStackTrace(Throwable throwable,
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 String getTime(long time,
String pattern)
- Utility method to format time.
- Overrides:
getTime
in class ExtensiblePatternFormatter
- Parameters:
time
- the timepattern
- ancilliary pattern parameter - allowed to be null
- Returns:
- the formatted string
Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.