Package net.logstash.logback.abbreviator
Class DefaultTargetLengthAbbreviator
java.lang.Object
net.logstash.logback.abbreviator.DefaultTargetLengthAbbreviator
- All Implemented Interfaces:
Abbreviator,LifeCycle
Abbreviates class names in a way similar to the Logback layout feature (see https://logback.qos.ch/manual/layouts.html#logger).
The algorithm will shorten the full class name and attempt to reduce its size to a maximum of length characters.
It does so by reducing the package elements to their first letter and gradually expand them starting from the right until
the maximum size is reached.
Setting the length to zero constitutes an exception and returns the "simple" class name without package.
The next table provides examples of the abbreviation algorithm in action.
LENGTH CLASSNAME SHORTENED ------------------------------------------------------------- 0 org.company.package.Bar Bar 5 org.company.package.Bar o.c.p.Bar 15 org.company.package.Bar o.c.package.Bar 21 org.company.package.Bar o.company.package.Bar 24 org.company.package.Bar org.company.package.Bar
- Author:
- brenuart
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabbreviate(String in) protected voidintbooleanvoidsetTargetLength(int targetLength) voidstart()voidstop()
-
Constructor Details
-
DefaultTargetLengthAbbreviator
public DefaultTargetLengthAbbreviator()
-
-
Method Details
-
isStarted
public boolean isStarted() -
start
public void start() -
stop
public void stop() -
abbreviate
- Specified by:
abbreviatein interfaceAbbreviator
-
setTargetLength
public void setTargetLength(int targetLength) -
getTargetLength
public int getTargetLength() -
assertStarted
protected void assertStarted()
-