Top Description Fields Constructors Methods
org.apache.log.format

public Class XMLFormatter

extends Object
implements Formatter
Class Inheritance
All Implemented Interfaces
org.apache.log.format.Formatter
Imports
java.util.Date, org.apache.log.LogEvent

Basic XML formatter that writes out a basic XML-ified log event. Note that this formatter assumes that the category and context values will produce strings that do not need to be escaped in XML.
Author
Peter Donald

Field Summary

Modifier and TypeField and Description
private static final String
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the formatted string
format
(final LogEvent
the event
event
)

Implements org.apache.log.format.Formatter.format.

Format log event into string.
public void
setPrintCategory(final boolean
true to print category, false otherwise
printCategory
)

Print out category field to log.

public void
setPrintContext(final boolean
true to print context, false otherwise
printContext
)

Print out context field to log.

public void
setPrintException(final boolean
true to print exception, false otherwise
printException
)

Print out exception field to log.

public void
setPrintMessage(final boolean
true to print message, false otherwise
printMessage
)

Print out message field to log.

public void
setPrintPriority(final boolean
true to print priority, false otherwise
printPriority
)

Print out priority field to log.

public void
setPrintRelativeTime(final boolean
true to print relativeTime, false otherwise
printRelativeTime
)

Print out relativeTime field to log.

public void
setPrintTime(final boolean
true to print time, false otherwise
printTime
)

Print out time field to log.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EOLback to summary
private static final String EOL
m_printCategoryback to summary
private boolean m_printCategory
m_printContextback to summary
private boolean m_printContext
m_printExceptionback to summary
private boolean m_printException
m_printMessageback to summary
private boolean m_printMessage
m_printNumericTimeback to summary
private boolean m_printNumericTime
m_printPriorityback to summary
private boolean m_printPriority
m_printRelativeTimeback to summary
private boolean m_printRelativeTime
m_printTimeback to summary
private boolean m_printTime

Constructor Detail

XMLFormatterback to summary
public XMLFormatter()

Method Detail

formatback to summary
public String format(final LogEvent event)

Implements org.apache.log.format.Formatter.format.

Format log event into string.

Parameters
event:LogEvent

the event

Returns:String

the formatted string

setPrintCategoryback to summary
public void setPrintCategory(final boolean printCategory)

Print out category field to log.

Parameters
printCategory:boolean

true to print category, false otherwise

setPrintContextback to summary
public void setPrintContext(final boolean printContext)

Print out context field to log.

Parameters
printContext:boolean

true to print context, false otherwise

setPrintExceptionback to summary
public void setPrintException(final boolean printException)

Print out exception field to log.

Parameters
printException:boolean

true to print exception, false otherwise

setPrintMessageback to summary
public void setPrintMessage(final boolean printMessage)

Print out message field to log.

Parameters
printMessage:boolean

true to print message, false otherwise

setPrintPriorityback to summary
public void setPrintPriority(final boolean printPriority)

Print out priority field to log.

Parameters
printPriority:boolean

true to print priority, false otherwise

setPrintRelativeTimeback to summary
public void setPrintRelativeTime(final boolean printRelativeTime)

Print out relativeTime field to log.

Parameters
printRelativeTime:boolean

true to print relativeTime, false otherwise

setPrintTimeback to summary
public void setPrintTime(final boolean printTime)

Print out time field to log.

Parameters
printTime:boolean

true to print time, false otherwise