Package org.apache.log4j.chainsaw
Class XMLFileHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.log4j.chainsaw.XMLFileHandler
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
class XMLFileHandler extends org.xml.sax.helpers.DefaultHandler
A content handler for document containing Log4J events logged using the XMLLayout class. It will create events and add them to a supplied model.- Version:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringBuffer
mBuf
buffer for collecting textprivate java.lang.String
mCategoryName
the category of the eventprivate Level
mLevel
the priority (level) of the eventprivate java.lang.String
mLocationDetails
the location details for the eventprivate java.lang.String
mMessage
the msg for the eventprivate MyTableModel
mModel
where to put the eventsprivate java.lang.String
mNDC
the NDC for the eventprivate int
mNumEvents
the number of events in the documentprivate java.lang.String
mThreadName
the thread for the eventprivate java.lang.String[]
mThrowableStrRep
the throwable details the eventprivate long
mTimeStamp
the time of the eventprivate static java.lang.String
TAG_EVENT
represents the event tagprivate static java.lang.String
TAG_LOCATION_INFO
represents the location info tagprivate static java.lang.String
TAG_MESSAGE
represents the message tagprivate static java.lang.String
TAG_NDC
represents the ndc tagprivate static java.lang.String
TAG_THROWABLE
represents the throwable tag
-
Constructor Summary
Constructors Constructor Description XMLFileHandler(MyTableModel aModel)
Creates a newXMLFileHandler
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addEvent()
Add an event to the modelvoid
characters(char[] aChars, int aStart, int aLength)
void
endElement(java.lang.String aNamespaceURI, java.lang.String aLocalName, java.lang.String aQName)
(package private) int
getNumEvents()
private void
resetData()
Reset the data for an eventvoid
startDocument()
void
startElement(java.lang.String aNamespaceURI, java.lang.String aLocalName, java.lang.String aQName, org.xml.sax.Attributes aAtts)
-
-
-
Field Detail
-
TAG_EVENT
private static final java.lang.String TAG_EVENT
represents the event tag- See Also:
- Constant Field Values
-
TAG_MESSAGE
private static final java.lang.String TAG_MESSAGE
represents the message tag- See Also:
- Constant Field Values
-
TAG_NDC
private static final java.lang.String TAG_NDC
represents the ndc tag- See Also:
- Constant Field Values
-
TAG_THROWABLE
private static final java.lang.String TAG_THROWABLE
represents the throwable tag- See Also:
- Constant Field Values
-
TAG_LOCATION_INFO
private static final java.lang.String TAG_LOCATION_INFO
represents the location info tag- See Also:
- Constant Field Values
-
mModel
private final MyTableModel mModel
where to put the events
-
mNumEvents
private int mNumEvents
the number of events in the document
-
mTimeStamp
private long mTimeStamp
the time of the event
-
mLevel
private Level mLevel
the priority (level) of the event
-
mCategoryName
private java.lang.String mCategoryName
the category of the event
-
mNDC
private java.lang.String mNDC
the NDC for the event
-
mThreadName
private java.lang.String mThreadName
the thread for the event
-
mMessage
private java.lang.String mMessage
the msg for the event
-
mThrowableStrRep
private java.lang.String[] mThrowableStrRep
the throwable details the event
-
mLocationDetails
private java.lang.String mLocationDetails
the location details for the event
-
mBuf
private final java.lang.StringBuffer mBuf
buffer for collecting text
-
-
Constructor Detail
-
XMLFileHandler
XMLFileHandler(MyTableModel aModel)
Creates a newXMLFileHandler
instance.- Parameters:
aModel
- where to add the events
-
-
Method Detail
-
startDocument
public void startDocument() throws org.xml.sax.SAXException
- Specified by:
startDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
- See Also:
DefaultHandler
-
characters
public void characters(char[] aChars, int aStart, int aLength)
- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.xml.sax.helpers.DefaultHandler
- See Also:
DefaultHandler
-
endElement
public void endElement(java.lang.String aNamespaceURI, java.lang.String aLocalName, java.lang.String aQName)
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- See Also:
DefaultHandler
-
startElement
public void startElement(java.lang.String aNamespaceURI, java.lang.String aLocalName, java.lang.String aQName, org.xml.sax.Attributes aAtts)
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- See Also:
DefaultHandler
-
getNumEvents
int getNumEvents()
- Returns:
- the number of events in the document
-
addEvent
private void addEvent()
Add an event to the model
-
resetData
private void resetData()
Reset the data for an event
-
-