Top Description Fields Constructors Methods
ch.qos.logback.classic.log4j

public Class XMLLayout

extends LayoutBase<ILoggingEvent>
Class Inheritance
Imports
java.util.Map, .Set, .Map.Entry, ch.qos.logback.classic.spi.ILoggingEvent, .IThrowableProxy, .StackTraceElementProxy, ch.qos.logback.core.CoreConstants, .LayoutBase, ch.qos.logback.core.helpers.Transform

Generates log4j.dtd compliant XML documents.
Author
Ceki Gülcü

Field Summary

Modifier and TypeField and Description
private StringBuilder
private final int
private boolean
private boolean
private final int
Inherited from ch.qos.logback.core.LayoutBase:
started

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
doLayout(ILoggingEvent
The event to format
event
)

Implements ch.qos.logback.core.Layout.doLayout.

Formats a ILoggingEvent in conformity with the log4j.dtd.
public String
getContentType()

Overrides ch.qos.logback.core.LayoutBase.getContentType.

Implements ch.qos.logback.core.Layout.getContentType.

Returns the content type as appropriate for the implementation.
public boolean
getLocationInfo()

Returns the current value of the LocationInfo option.

public boolean

Returns:

true if MDC key-value pairs are output.
getProperties
()

Gets whether MDC key-value pairs should be output.

public void
setLocationInfo(boolean flag)

The LocationInfo option takes a boolean value.

public void
setProperties(final boolean
new value.
flag
)

Sets whether MDC key-value pairs should be output, default false.

public void
Inherited from ch.qos.logback.core.LayoutBase:
getContextgetFileFootergetFileHeadergetPresentationFootergetPresentationHeaderisStartedsetContextsetFileFootersetFileHeadersetPresentationFootersetPresentationHeaderstop

Field Detail

bufback to summary
private StringBuilder buf
DEFAULT_SIZEback to summary
private final int DEFAULT_SIZE
locationInfoback to summary
private boolean locationInfo
propertiesback to summary
private boolean properties
UPPER_LIMITback to summary
private final int UPPER_LIMIT

Constructor Detail

XMLLayoutback to summary
public XMLLayout()

Method Detail

doLayoutback to summary
public String doLayout(ILoggingEvent event)

Implements ch.qos.logback.core.Layout.doLayout.

Formats a ILoggingEvent in conformity with the log4j.dtd.

Parameters
event:ILoggingEvent

Doc from ch.qos.logback.core.Layout.doLayout.

The event to format

Returns:String

Doc from ch.qos.logback.core.Layout.doLayout.

the event formatted as a String

getContentTypeback to summary
public String getContentType()

Overrides ch.qos.logback.core.LayoutBase.getContentType.

Implements ch.qos.logback.core.Layout.getContentType.

Doc from ch.qos.logback.core.Layout.getContentType.

Returns the content type as appropriate for the implementation.

Annotations
@Override
getLocationInfoback to summary
public boolean getLocationInfo()

Returns the current value of the LocationInfo option.

getPropertiesback to summary
public boolean getProperties()

Gets whether MDC key-value pairs should be output.

Returns:boolean

true if MDC key-value pairs are output.

Since
1.2.15
setLocationInfoback to summary
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 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 org.apache.log4j.net.SMTPAppender then make sure to set the LocationInfo option of that appender as well.

setPropertiesback to summary
public void setProperties(final boolean flag)

Sets whether MDC key-value pairs should be output, default false.

Parameters
flag:boolean

new value.

Since
1.2.15
startback to summary
public void start()

Overrides ch.qos.logback.core.LayoutBase.start.

Implements ch.qos.logback.core.spi.LifeCycle.start.

Annotations
@Override