Package org.apache.log4j.pattern
Class NameAbbreviator
- java.lang.Object
-
- org.apache.log4j.pattern.NameAbbreviator
-
- Direct Known Subclasses:
NameAbbreviator.DropElementAbbreviator
,NameAbbreviator.MaxElementAbbreviator
,NameAbbreviator.NOPAbbreviator
,NameAbbreviator.PatternAbbreviator
public abstract class NameAbbreviator extends java.lang.Object
NameAbbreviator generates abbreviated logger and class names.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
NameAbbreviator.DropElementAbbreviator
Abbreviator that drops starting path elements.private static class
NameAbbreviator.MaxElementAbbreviator
Abbreviator that drops starting path elements.private static class
NameAbbreviator.NOPAbbreviator
Abbreviator that simply appends full name to buffer.private static class
NameAbbreviator.PatternAbbreviator
Pattern abbreviator.private static class
NameAbbreviator.PatternAbbreviatorFragment
Fragment of an pattern abbreviator.
-
Field Summary
Fields Modifier and Type Field Description private static NameAbbreviator
DEFAULT
Default (no abbreviation) abbreviator.
-
Constructor Summary
Constructors Constructor Description NameAbbreviator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
abbreviate(int nameStart, java.lang.StringBuffer buf)
Abbreviates a name in a StringBuffer.static NameAbbreviator
getAbbreviator(java.lang.String pattern)
Gets an abbreviator.static NameAbbreviator
getDefaultAbbreviator()
Gets default abbreviator.
-
-
-
Field Detail
-
DEFAULT
private static final NameAbbreviator DEFAULT
Default (no abbreviation) abbreviator.
-
-
Method Detail
-
getAbbreviator
public static NameAbbreviator getAbbreviator(java.lang.String pattern)
Gets an abbreviator. For example, "%logger{2}" will output only 2 elements of the logger name, %logger{-2} will drop 2 elements from the logger name, "%logger{1.}" will output only the first character of the non-final elements in the name, "%logger{1~.2~} will output the first character of the first element, two characters of the second and subsequent elements and will use a tilde to indicate abbreviated characters.- Parameters:
pattern
- abbreviation pattern.- Returns:
- abbreviator, will not be null.
-
getDefaultAbbreviator
public static NameAbbreviator getDefaultAbbreviator()
Gets default abbreviator.- Returns:
- default abbreviator.
-
abbreviate
public abstract void abbreviate(int nameStart, java.lang.StringBuffer buf)
Abbreviates a name in a StringBuffer.- Parameters:
nameStart
- starting position of name in buf.buf
- buffer, may not be null.
-
-