Package ch.qos.logback.classic.log4j
Class XMLLayout
- All Implemented Interfaces:
Layout<ILoggingEvent>,ContextAware,LifeCycle
Generates log4j.dtd compliant XML documents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringBuilderprivate final intprivate booleanprivate booleanprivate final intFields inherited from class ch.qos.logback.core.LayoutBase
startedFields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoLayout(ILoggingEvent event) Formats aILoggingEventin conformity with the log4j.dtd.Returns the content type as appropriate for the implementation.booleanReturns the current value of the LocationInfo option.booleanGets whether MDC key-value pairs should be output.voidsetLocationInfo(boolean flag) The LocationInfo option takes a boolean value.voidsetProperties(boolean flag) Sets whether MDC key-value pairs should be output, default false.voidstart()Methods inherited from class ch.qos.logback.core.LayoutBase
getContext, getFileFooter, getFileHeader, getPresentationFooter, getPresentationHeader, isStarted, setContext, setFileFooter, setFileHeader, setPresentationFooter, setPresentationHeader, stopMethods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getDeclaredOrigin, getStatusManager
-
Field Details
-
DEFAULT_SIZE
private final int DEFAULT_SIZE- See Also:
-
UPPER_LIMIT
private final int UPPER_LIMIT- See Also:
-
buf
-
locationInfo
private boolean locationInfo -
properties
private boolean properties
-
-
Constructor Details
-
XMLLayout
public XMLLayout()
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceLifeCycle- Overrides:
startin classLayoutBase<ILoggingEvent>
-
setLocationInfo
public void setLocationInfo(boolean flag) The LocationInfo option takes a boolean value. By default, it is set to false which means there will be no location information output by this layout. If the the option is set to true, then the file name and line number of the statement at the origin of the log statement will be output.If you are embedding this layout within an
SMTPAppenderthen make sure to set the LocationInfo option of that appender as well. -
getLocationInfo
public boolean getLocationInfo()Returns the current value of the LocationInfo option. -
setProperties
public void setProperties(boolean flag) Sets whether MDC key-value pairs should be output, default false.- Parameters:
flag- new value.- Since:
- 1.2.15
-
getProperties
public boolean getProperties()Gets whether MDC key-value pairs should be output.- Returns:
- true if MDC key-value pairs are output.
- Since:
- 1.2.15
-
doLayout
Formats aILoggingEventin conformity with the log4j.dtd.- Parameters:
event- The event to format- Returns:
- the event formatted as a String
-
getContentType
Description copied from interface:LayoutReturns the content type as appropriate for the implementation.- Specified by:
getContentTypein interfaceLayout<ILoggingEvent>- Overrides:
getContentTypein classLayoutBase<ILoggingEvent>- Returns:
-