org.apache.log4j
Class MyPatternParser

java.lang.Object
  extended by org.apache.log4j.helpers.PatternParser
      extended by org.apache.log4j.MyPatternParser

public class MyPatternParser
extends PatternParser

Example showing how to extend PatternParser to recognize additional conversion characters. The examples shows that minimum and maximum width and alignment settings apply for "extension" conversion characters just as they do for EnhancedPatternLayout recognized characters.

In this case MyPatternParser recognizes %# and outputs the value of an internal counter which is also incremented at each call. See source code for more details.

Author:
Anders Kristensen
See Also:
MyPatternLayout, PatternParser, EnhancedPatternLayout

Field Summary
 
Fields inherited from class org.apache.log4j.helpers.PatternParser
currentLiteral, formattingInfo, i, pattern, patternLength
 
Constructor Summary
MyPatternParser(java.lang.String pattern)
           
 
Method Summary
 void finalizeConverter(char c)
           
 
Methods inherited from class org.apache.log4j.helpers.PatternParser
addConverter, extractOption, extractPrecisionOption, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyPatternParser

public MyPatternParser(java.lang.String pattern)
Method Detail

finalizeConverter

public void finalizeConverter(char c)
Overrides:
finalizeConverter in class PatternParser


Copyright © 2010 The Apache Software Foundation. Licensed under the Apache License, Version 2.0

Apache Extras Companion for Apache log4j, Apache log4j and Apache are trademarks of the Apache Software Foundation.