org.apache.cocoon.util.log
Class CocoonLogFormatter

java.lang.Object
  extended byorg.apache.cocoon.util.log.ExtensiblePatternFormatter
      extended byorg.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:

Version:
$Id: CocoonLogFormatter.java 326589 2005-10-19 15:55:45Z sylvain $
Author:
Sylvain Wallez, Vadim Gritsenko

Nested Class Summary
 
Nested classes inherited from class org.apache.cocoon.util.log.ExtensiblePatternFormatter
ExtensiblePatternFormatter.PatternRun
 
Field Summary
static int DEFAULT_STACK_DEPTH
          The constant defining the default stack depth when none other is specified.
protected static int TYPE_CLASS
           
protected static String TYPE_CLASS_SHORT_STR
           
protected static String TYPE_CLASS_STR
           
protected static int TYPE_HOST
           
protected static String TYPE_HOST_STR
           
protected static int TYPE_QUERY
           
protected static String TYPE_QUERY_STR
           
protected static int TYPE_ROOTTHROWABLE
           
protected static String TYPE_ROOTTHROWABLE_STR
           
protected static int TYPE_THREAD
           
protected static String TYPE_THREAD_STR
           
protected static int TYPE_URI
           
protected static String TYPE_URI_STR
           
 
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
 
Constructor Summary
CocoonLogFormatter()
           
CocoonLogFormatter(int stackDepth)
           
 
Method Summary
protected  String formatPatternRun(org.apache.log.LogEvent event, ExtensiblePatternFormatter.PatternRun run)
          Formats a single pattern run (can be extended in subclasses).
protected  String getStackTrace(Throwable throwable, String format)
          Utility method to format stack trace so that CascadingExceptions are formatted with all nested exceptions.
protected  String getTime(long time, String pattern)
          Utility method to format time.
protected  int getTypeIdFor(String type)
          Retrieve the type-id for a particular string.
 
Methods inherited from class org.apache.cocoon.util.log.ExtensiblePatternFormatter
addPatternRun, addTextRun, append, 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
 

Field Detail

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
Constructor Detail

CocoonLogFormatter

public CocoonLogFormatter()

CocoonLogFormatter

public CocoonLogFormatter(int stackDepth)
Method Detail

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 instance
format - 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 time
pattern - ancilliary pattern parameter - allowed to be null
Returns:
the formatted string


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.