Package org.apache.log4j.receivers.xml
Class UtilLoggingXMLDecoder
- java.lang.Object
-
- org.apache.log4j.receivers.xml.UtilLoggingXMLDecoder
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.MapadditionalPropertiesAdditional properties.private static java.lang.StringBEGIN_PARTDocument prolog.private javax.xml.parsers.DocumentBuilderdocBuilderDocument builder.private static java.lang.StringENCODINGprivate static java.lang.StringEND_PARTDocument close.private java.awt.ComponentownerOwner.private java.lang.StringpartialEventPartial event.private static java.lang.StringRECORD_ENDRecord end.
-
Constructor Summary
Constructors Constructor Description UtilLoggingXMLDecoder()Create new instance.UtilLoggingXMLDecoder(java.awt.Component o)Create new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.log4j.spi.LoggingEventdecode(java.lang.String data)Converts the string data into an XML Document, and then soaks out the relevant bits to form a new LoggingEvent instance which can be used by any Log4j element locally.java.util.Vectordecode(java.net.URL url)Decodes a File into a Vector of LoggingEvents.java.util.VectordecodeEvents(java.lang.String document)Decodes a String representing a number of events into a Vector of LoggingEvents.private java.util.VectordecodeEvents(org.w3c.dom.Document document)Given a Document, converts the XML into a Vector of LoggingEvents.private java.lang.StringgetCData(org.w3c.dom.Node n)Get contents of CDATASection.private org.w3c.dom.Documentparse(java.lang.String data)Converts the LoggingEvent data in XML string format into an actual XML Document class instance.voidsetAdditionalProperties(java.util.Map properties)Sets an additionalProperty map, where each Key/Value pair is automatically added to each LoggingEvent as it is decoded.
-
-
-
Field Detail
-
BEGIN_PART
private static final java.lang.String BEGIN_PART
Document prolog.- See Also:
- Constant Field Values
-
END_PART
private static final java.lang.String END_PART
Document close.- See Also:
- Constant Field Values
-
docBuilder
private javax.xml.parsers.DocumentBuilder docBuilder
Document builder.
-
additionalProperties
private java.util.Map additionalProperties
Additional properties.
-
partialEvent
private java.lang.String partialEvent
Partial event.
-
RECORD_END
private static final java.lang.String RECORD_END
Record end.- See Also:
- Constant Field Values
-
owner
private java.awt.Component owner
Owner.
-
ENCODING
private static final java.lang.String ENCODING
- See Also:
- Constant Field Values
-
-
Method Detail
-
setAdditionalProperties
public void setAdditionalProperties(java.util.Map properties)
Sets an additionalProperty map, where each Key/Value pair is automatically added to each LoggingEvent as it is decoded. This is useful, say, to include the source file name of the Logging events- Specified by:
setAdditionalPropertiesin interfaceDecoder- Parameters:
properties- additional properties
-
parse
private org.w3c.dom.Document parse(java.lang.String data)
Converts the LoggingEvent data in XML string format into an actual XML Document class instance.- Parameters:
data- XML fragment- Returns:
- dom document
-
decode
public java.util.Vector decode(java.net.URL url) throws java.io.IOExceptionDecodes a File into a Vector of LoggingEvents.
-
decodeEvents
public java.util.Vector decodeEvents(java.lang.String document)
Decodes a String representing a number of events into a Vector of LoggingEvents.- Specified by:
decodeEventsin interfaceDecoder- Parameters:
document- to decode events from- Returns:
- Vector of LoggingEvents
-
decode
public org.apache.log4j.spi.LoggingEvent decode(java.lang.String data)
Converts the string data into an XML Document, and then soaks out the relevant bits to form a new LoggingEvent instance which can be used by any Log4j element locally.
-
decodeEvents
private java.util.Vector decodeEvents(org.w3c.dom.Document document)
Given a Document, converts the XML into a Vector of LoggingEvents.- Parameters:
document- XML document- Returns:
- Vector of LoggingEvents
-
getCData
private java.lang.String getCData(org.w3c.dom.Node n)
Get contents of CDATASection.- Parameters:
n- CDATASection- Returns:
- text content of all text or CDATA children of node.
-
-