- java.lang.Object
-
- ch.qos.logback.core.pattern.Converter<E>
-
- ch.qos.logback.core.pattern.FormattingConverter<E>
-
- ch.qos.logback.core.pattern.DynamicConverter<ILoggingEvent>
-
- ch.qos.logback.classic.pattern.ClassicConverter
-
- ch.qos.logback.classic.pattern.NamedConverter
-
- All Implemented Interfaces:
ContextAware,LifeCycle
- Direct Known Subclasses:
ClassOfCallerConverter,LoggerConverter
public abstract class NamedConverter extends ClassicConverter
In case abbreviation service is requested, NamedConverter will convert fully qualified class names to their abbreviated from. NamedConverter instances will store abbreviated names in an internal LRU cache. The cache will double in size if he cache miss rate is consistently above 30%. Assuming a high miss rate, the doubling until a maximum size of 2048 is attained. If at this point the cache miss rate is still too high, NamedConverter will revert to non cached behavior. The general assumption here is that a large majority of logger names are concentrated within a group of approximately 1000 logger names.- Author:
- Ceki Gulcu
-
-
Field Summary
-
Fields inherited from class ch.qos.logback.core.pattern.DynamicConverter
started
-
-
Constructor Summary
Constructors Constructor Description NamedConverter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Stringconvert(ILoggingEvent event)The convert method is responsible for extracting data from the event and returning a formatted string representation.intgetCacheMisses()doublegetCacheMissRate()protected abstract StringgetFullyQualifiedName(ILoggingEvent event)Gets fully qualified name from event.voidstart()Components that depend on options passed during configuration can override this method in order to make appropriate use of those options.-
Methods inherited from class ch.qos.logback.core.pattern.DynamicConverter
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getFirstOption, getOptionList, isStarted, setContext, setOptionList, stop
-
Methods inherited from class ch.qos.logback.core.pattern.FormattingConverter
getFormattingInfo, setFormattingInfo, write
-
-
-
-
Constructor Detail
-
NamedConverter
public NamedConverter()
-
-
Method Detail
-
getFullyQualifiedName
protected abstract String getFullyQualifiedName(ILoggingEvent event)
Gets fully qualified name from event.- Parameters:
event- The LoggingEvent to process, cannot not be null.- Returns:
- name, must not be null.
-
start
public void start()
Description copied from class:DynamicConverterComponents that depend on options passed during configuration can override this method in order to make appropriate use of those options. For simpler components, the trivial implementation found in this abstract class will be sufficient.- Specified by:
startin interfaceLifeCycle- Overrides:
startin classDynamicConverter<ILoggingEvent>
-
convert
public String convert(ILoggingEvent event)
Description copied from class:ConverterThe convert method is responsible for extracting data from the event and returning a formatted string representation.- Specified by:
convertin classConverter<ILoggingEvent>- Parameters:
event- the event to convert- Returns:
- the formatted string representation
-
getCacheMissRate
public double getCacheMissRate()
-
getCacheMisses
public int getCacheMisses()
-
-