org.apache.cocoon.util.log
Class ExtensiblePatternFormatter

java.lang.Object
  extended by org.apache.cocoon.util.log.ExtensiblePatternFormatter
All Implemented Interfaces:
Formatter
Direct Known Subclasses:
CocoonLogFormatter

Deprecated. This class will be removed in 2.2

public class ExtensiblePatternFormatter
extends Object
implements Formatter

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.

Version:
CVS $Id: ExtensiblePatternFormatter.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Peter Donald, Sylvain Wallez

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

TYPE_TEXT

protected static final int TYPE_TEXT
Deprecated. 
See Also:
Constant Field Values

TYPE_CATEGORY

protected static final int TYPE_CATEGORY
Deprecated. 
See Also:
Constant Field Values

TYPE_MESSAGE

protected static final int TYPE_MESSAGE
Deprecated. 
See Also:
Constant Field Values

TYPE_TIME

protected static final int TYPE_TIME
Deprecated. 
See Also:
Constant Field Values

TYPE_RELATIVE_TIME

protected static final int TYPE_RELATIVE_TIME
Deprecated. 
See Also:
Constant Field Values

TYPE_THROWABLE

protected static final int TYPE_THROWABLE
Deprecated. 
See Also:
Constant Field Values

TYPE_PRIORITY

protected static final int TYPE_PRIORITY
Deprecated. 
See Also:
Constant Field Values

MAX_TYPE

protected static final int MAX_TYPE
Deprecated. 
The maximum value used for TYPEs. Subclasses can define their own TYPEs starting at MAX_TYPE + 1.

See Also:
Constant Field Values

TYPE_CATEGORY_STR

protected static final String TYPE_CATEGORY_STR
Deprecated. 
See Also:
Constant Field Values

TYPE_MESSAGE_STR

protected static final String TYPE_MESSAGE_STR
Deprecated. 
See Also:
Constant Field Values

TYPE_TIME_STR

protected static final String TYPE_TIME_STR
Deprecated. 
See Also:
Constant Field Values

TYPE_RELATIVE_TIME_STR

protected static final String TYPE_RELATIVE_TIME_STR
Deprecated. 
See Also:
Constant Field Values

TYPE_THROWABLE_STR

protected static final String TYPE_THROWABLE_STR
Deprecated. 
See Also:
Constant Field Values

TYPE_PRIORITY_STR

protected static final String TYPE_PRIORITY_STR
Deprecated. 
See Also:
Constant Field Values

m_formatSpecification

protected ExtensiblePatternFormatter.PatternRun[] m_formatSpecification
Deprecated. 
Constructor Detail

ExtensiblePatternFormatter

public ExtensiblePatternFormatter()
Deprecated. 
Method Detail

addPatternRun

protected int addPatternRun(Stack stack,
                            char[] pattern,
                            int index)
Deprecated. 
Extract and build a pattern from input string.

Parameters:
stack - the stack on which to place patterns
pattern - the input string
index - the start of pattern run
Returns:
the number of characters in pattern run

addTextRun

protected int addTextRun(Stack stack,
                         char[] pattern,
                         int index)
Deprecated. 
Extract and build a text run from input string. It does special handling of '\n' and '\t' replaceing them with newline and tab.

Parameters:
stack - the stack on which to place runs
pattern - the input string
index - the start of the text run
Returns:
the number of characters in run

append

protected void append(StringBuffer sb,
                      int minSize,
                      int maxSize,
                      boolean rightJustify,
                      String output)
Deprecated. 
Utility to append a string to buffer given certain constraints.

Parameters:
sb - the StringBuffer
minSize - 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 string

format

public String format(LogEvent event)
Deprecated. 
Format the event according to the pattern.

Specified by:
format in interface Formatter
Parameters:
event - the event
Returns:
the formatted output

formatPatternRun

protected String formatPatternRun(LogEvent event,
                                  ExtensiblePatternFormatter.PatternRun run)
Deprecated. 
Formats a single pattern run (can be extended in subclasses).

Parameters:
run - the pattern run to format.
Returns:
the formatted result.

getCategory

protected String getCategory(String category,
                             String format)
Deprecated. 
Utility method to format category.

Parameters:
category - the category string
format - ancilliary format parameter - allowed to be null
Returns:
the formatted string

getPriority

protected String getPriority(Priority priority,
                             String format)
Deprecated. 
Get formatted priority string.


fix

protected final String fix(String context)
Deprecated. 
Correct a context string by replacing '.''s with a '_'.

Parameters:
context - the un-fixed context
Returns:
the fixed context

getMessage

protected String getMessage(String message,
                            String format)
Deprecated. 
Utility method to format message.

Parameters:
message - the message string
format - ancilliary format parameter - allowed to be null
Returns:
the formatted string

getStackTrace

protected String getStackTrace(Throwable throwable,
                               String format)
Deprecated. 
Utility method to format stack trace.

Parameters:
throwable - the throwable instance
format - ancilliary format parameter - allowed to be null
Returns:
the formatted string

getTime

protected String getTime(long time,
                         String format)
Deprecated. 
Utility method to format time.

Parameters:
time - the time
format - ancilliary format parameter - allowed to be null
Returns:
the formatted string

getTypeIdFor

protected int getTypeIdFor(String type)
Deprecated. 
Retrieve the type-id for a particular string.

Parameters:
type - the string
Returns:
the type-id

parse

protected void parse(String patternString)
Deprecated. 
Parse the input pattern and build internal data structures.

Parameters:
patternString - the pattern

setFormat

public void setFormat(String format)
Deprecated. 
Set the string description that the format is extracted from.

Parameters:
format - the string format


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.