org.apache.logging.log4j.core.pattern
Class NameAbbreviator

java.lang.Object
  extended by org.apache.logging.log4j.core.pattern.NameAbbreviator

public abstract class NameAbbreviator
extends Object

NameAbbreviator generates abbreviated logger and class names.


Constructor Summary
NameAbbreviator()
           
 
Method Summary
abstract  String abbreviate(String buf)
          Abbreviates a name in a String.
static NameAbbreviator getAbbreviator(String pattern)
          Gets an abbreviator.
static NameAbbreviator getDefaultAbbreviator()
          Gets default abbreviator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NameAbbreviator

public NameAbbreviator()
Method Detail

getAbbreviator

public static NameAbbreviator getAbbreviator(String pattern)
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

public static NameAbbreviator getDefaultAbbreviator()
Gets default abbreviator.

Returns:
default abbreviator.

abbreviate

public abstract String abbreviate(String buf)
Abbreviates a name in a String.

Parameters:
buf - buffer, may not be null.
Returns:
The abbreviated String.


Copyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.