- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.LayoutBase<E>
-
- ch.qos.logback.core.pattern.PatternLayoutBase<E>
-
- All Implemented Interfaces:
Layout<E>,ContextAware,LifeCycle
- Direct Known Subclasses:
PatternLayout
public abstract class PatternLayoutBase<E> extends LayoutBase<E>
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanoutputPatternAsHeaderprotected PostCompileProcessor<E>postCompileProcessor-
Fields inherited from class ch.qos.logback.core.LayoutBase
started
-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description PatternLayoutBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract Map<String,String>getDefaultConverterMap()Deprecated.protected abstract Map<String,Supplier<DynamicConverter>>getDefaultConverterSupplierMap()Concrete implementations of this class are responsible for elaborating the mapping between pattern words and supplying converter instances.Map<String,Supplier<DynamicConverter>>getEffectiveConverterMap()Returns a map where the default converter map is merged with the map contained in the context.Map<String,Supplier<DynamicConverter>>getInstanceConverterMap()StringgetPattern()StringgetPresentationHeader()Return the header of the logging event formatting.protected StringgetPresentationHeaderPrefix()booleanisOutputPatternAsHeader()protected voidsetContextForConverters(Converter<E> head)voidsetOutputPatternAsHeader(boolean outputPatternAsHeader)voidsetPattern(String pattern)voidsetPostCompileProcessor(PostCompileProcessor<E> postCompileProcessor)voidstart()StringtoString()protected StringwriteLoopOnConverters(E event)-
Methods inherited from class ch.qos.logback.core.LayoutBase
getContentType, getContext, getFileFooter, getFileHeader, getPresentationFooter, isStarted, setContext, setFileFooter, setFileHeader, setPresentationFooter, setPresentationHeader, stop
-
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getDeclaredOrigin, getStatusManager
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
postCompileProcessor
protected PostCompileProcessor<E> postCompileProcessor
-
outputPatternAsHeader
protected boolean outputPatternAsHeader
-
-
Constructor Detail
-
PatternLayoutBase
public PatternLayoutBase()
-
-
Method Detail
-
getDefaultConverterSupplierMap
protected abstract Map<String,Supplier<DynamicConverter>> getDefaultConverterSupplierMap()
Concrete implementations of this class are responsible for elaborating the mapping between pattern words and supplying converter instances.- Returns:
- A map associating pattern words to the names of converter suppliers
- Since:
- 1.5.13
-
getDefaultConverterMap
@Deprecated public abstract Map<String,String> getDefaultConverterMap()
Deprecated.BEWARE: The map of type String,String for mapping conversion words is deprecated. Use
getDefaultConverterSupplierMap()instead.Existing code such as getDefaultMap().put("k", X.class.getName()) should be replaced by getDefaultConverterSupplierMap().put("k", X::new)
Note that values in the map will still be taken into account and processed correctly.
- Returns:
- a map of keys and class names
-
getEffectiveConverterMap
public Map<String,Supplier<DynamicConverter>> getEffectiveConverterMap()
Returns a map where the default converter map is merged with the map contained in the context.
-
start
public void start()
- Specified by:
startin interfaceLifeCycle- Overrides:
startin classLayoutBase<E>
-
setPostCompileProcessor
public void setPostCompileProcessor(PostCompileProcessor<E> postCompileProcessor)
-
setContextForConverters
protected void setContextForConverters(Converter<E> head)
Deprecated.UseConverterUtil.setContextForConverters(ch.qos.logback.core.Context, ch.qos.logback.core.pattern.Converter<E>)instead. This method will be removed in future releases.- Parameters:
head-
-
writeLoopOnConverters
protected String writeLoopOnConverters(E event)
-
getPattern
public String getPattern()
-
setPattern
public void setPattern(String pattern)
-
getInstanceConverterMap
public Map<String,Supplier<DynamicConverter>> getInstanceConverterMap()
-
getPresentationHeaderPrefix
protected String getPresentationHeaderPrefix()
-
isOutputPatternAsHeader
public boolean isOutputPatternAsHeader()
-
setOutputPatternAsHeader
public void setOutputPatternAsHeader(boolean outputPatternAsHeader)
-
getPresentationHeader
public String getPresentationHeader()
Description copied from interface:LayoutReturn the header of the logging event formatting. The returned value may be null.- Specified by:
getPresentationHeaderin interfaceLayout<E>- Overrides:
getPresentationHeaderin classLayoutBase<E>- Returns:
- The header.
-
-