Class NameAbbreviator
java.lang.Object
org.apache.logging.log4j.core.pattern.NameAbbreviator
- Direct Known Subclasses:
NameAbbreviator.MaxElementAbbreviator,NameAbbreviator.NOPAbbreviator,NameAbbreviator.PatternAbbreviator
NameAbbreviator generates abbreviated logger and class names.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classAbbreviator that drops starting path elements.private static classAbbreviator that simply appends full name to buffer.private static final classPattern abbreviator.private static final classFragment of an pattern abbreviator. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final NameAbbreviatorDefault (no abbreviation) abbreviator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidabbreviate(String original, StringBuilder destination) Abbreviates a name in a String.static NameAbbreviatorgetAbbreviator(String pattern) Gets an abbreviator.static NameAbbreviatorGets default abbreviator.
-
Field Details
-
DEFAULT
Default (no abbreviation) abbreviator.
-
-
Constructor Details
-
NameAbbreviator
public NameAbbreviator()
-
-
Method Details
-
getAbbreviator
Gets an abbreviator.For example, "%logger{2}" will output only 2 elements of 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
Gets default abbreviator.- Returns:
- default abbreviator.
-
abbreviate
Abbreviates a name in a String.- Parameters:
original- the text to abbreviate, may not be null.destination- StringBuilder to write the result to
-