Package org.jboss.logmanager.formatters
Class XmlFormatter
java.lang.Object
java.util.logging.Formatter
org.jboss.logmanager.ExtFormatter
org.jboss.logmanager.formatters.StructuredFormatter
org.jboss.logmanager.formatters.XmlFormatter
A formatter that outputs the record in XML format.
The details include;
- Author:
- James R. Perkins
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jboss.logmanager.formatters.StructuredFormatter
StructuredFormatter.ExceptionOutputType, StructuredFormatter.Generator, StructuredFormatter.Key
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new XML formatter.XmlFormatter
(String keyOverrides) Creates a new XML formatter.XmlFormatter
(Map<StructuredFormatter.Key, String> keyOverrides) Creates a new XML formatter. -
Method Summary
Modifier and TypeMethodDescriptionprotected StructuredFormatter.Generator
createGenerator
(Writer writer) Creates the generator used to create the structured data.Returns the namespace URI used for each record ifisPrintNamespace()
istrue
.boolean
Indicates whether or not pretty printing is enabled.boolean
Indicates whether or not the name space should be written on the<record/>
.void
setNamespaceUri
(String namespaceUri) Sets the namespace URI used for each record ifisPrintNamespace()
istrue
.void
setPrettyPrint
(boolean prettyPrint) Turns on or off pretty printing.void
setPrintNamespace
(boolean printNamespace) Turns on or off the printing of the namespace for each<record/>
.Methods inherited from class org.jboss.logmanager.formatters.StructuredFormatter
after, before, format, getDateTimeFormatter, getExceptionOutputType, getKey, getKeyOverrides, getMetaData, getRecordDelimiter, getZoneId, isCallerCalculationRequired, isDetailedExceptionOutputType, isFormattedExceptionOutputType, isPrintDetails, setDateFormat, setExceptionOutputType, setMetaData, setPrintDetails, setRecordDelimiter, setZoneId
Methods inherited from class org.jboss.logmanager.ExtFormatter
format
Methods inherited from class java.util.logging.Formatter
formatMessage, getHead, getTail
-
Field Details
-
DEFAULT_NAMESPACE
- See Also:
-
-
Constructor Details
-
XmlFormatter
public XmlFormatter()Creates a new XML formatter. -
XmlFormatter
Creates a new XML formatter.If the
keyOverrides
is empty the default namespace will be used.- Parameters:
keyOverrides
- a string representation of a map to override keys- See Also:
-
XmlFormatter
Creates a new XML formatter.If the
keyOverrides
is empty the default namespace will be used.- Parameters:
keyOverrides
- a map of overrides for the default keys
-
-
Method Details
-
isPrettyPrint
public boolean isPrettyPrint()Indicates whether or not pretty printing is enabled.- Returns:
true
if pretty printing is enabled, otherwisefalse
-
setPrettyPrint
public void setPrettyPrint(boolean prettyPrint) Turns on or off pretty printing.- Parameters:
prettyPrint
-true
to turn on pretty printing orfalse
to turn it off
-
isPrintNamespace
public boolean isPrintNamespace()Indicates whether or not the name space should be written on the<record/>
.- Returns:
true
if the name space should be written for each record
-
setPrintNamespace
public void setPrintNamespace(boolean printNamespace) Turns on or off the printing of the namespace for each<record/>
. This is set tofalse
by default.- Parameters:
printNamespace
-true
if the name space should be written for each record
-
getNamespaceUri
Returns the namespace URI used for each record ifisPrintNamespace()
istrue
.- Returns:
- the namespace URI, may be
null
if explicitly set tonull
-
setNamespaceUri
Sets the namespace URI used for each record ifisPrintNamespace()
istrue
.- Parameters:
namespaceUri
- the namespace to use ornull
if no namespace URI should be used regardless of theisPrintNamespace()
value
-
createGenerator
Description copied from class:StructuredFormatter
Creates the generator used to create the structured data.- Specified by:
createGenerator
in classStructuredFormatter
- Returns:
- the generator to use
- Throws:
Exception
- if an error occurs creating the generator
-