Package org.apache.log4j.xml
Class UtilLoggingXMLDecoder
java.lang.Object
org.apache.log4j.xml.UtilLoggingXMLDecoder
- All Implemented Interfaces:
Decoder
Decodes JDK 1.4's java.util.logging package events
delivered via XML (using the logger.dtd).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map
Additional properties.private static final String
Document prolog.private DocumentBuilder
Document builder.private static final String
private static final String
Document close.private Component
Owner.private String
Partial event.private static final String
Record end. -
Constructor Summary
ConstructorsConstructorDescriptionCreate new instance.Create new instance. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.log4j.spi.LoggingEvent
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.Vector<org.apache.log4j.spi.LoggingEvent>
Decodes a File into a Vector of LoggingEvents.Vector<org.apache.log4j.spi.LoggingEvent>
decodeEvents
(String document) Decodes a String representing a number of events into a Vector of LoggingEvents.private Vector<org.apache.log4j.spi.LoggingEvent>
decodeEvents
(Document document) Given a Document, converts the XML into a Vector of LoggingEvents.private String
Get contents of CDATASection.private Document
Converts the LoggingEvent data in XML string format into an actual XML Document class instance.void
setAdditionalProperties
(Map properties) Sets an additionalProperty map, where each Key/Value pair is automatically added to each LoggingEvent as it is decoded.
-
Field Details
-
BEGIN_PART
Document prolog.- See Also:
-
END_PART
Document close.- See Also:
-
docBuilder
Document builder. -
additionalProperties
Additional properties. -
partialEvent
Partial event. -
RECORD_END
Record end.- See Also:
-
owner
Owner. -
ENCODING
- See Also:
-
-
Constructor Details
-
UtilLoggingXMLDecoder
Create new instance.- Parameters:
o
- owner
-
UtilLoggingXMLDecoder
public UtilLoggingXMLDecoder()Create new instance.
-
-
Method Details
-
setAdditionalProperties
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:
setAdditionalProperties
in interfaceDecoder
- Parameters:
properties
- additional properties
-
parse
Converts the LoggingEvent data in XML string format into an actual XML Document class instance.- Parameters:
data
- XML fragment- Returns:
- dom document
-
decode
Decodes a File into a Vector of LoggingEvents.- Specified by:
decode
in interfaceDecoder
- Parameters:
url
- the url of a file containing events to decode- Returns:
- Vector of LoggingEvents
- Throws:
IOException
- if IO error during processing.
-
decodeEvents
Decodes a String representing a number of events into a Vector of LoggingEvents.- Specified by:
decodeEvents
in interfaceDecoder
- Parameters:
document
- to decode events from- Returns:
- Vector of LoggingEvents
-
decode
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
Given a Document, converts the XML into a Vector of LoggingEvents.- Parameters:
document
- XML document- Returns:
- Vector of LoggingEvents
-
getCData
Get contents of CDATASection.- Parameters:
n
- CDATASection- Returns:
- text content of all text or CDATA children of node.
-