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.DefaultHandlerA 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.StringBuffermBufbuffer for collecting textprivate java.lang.StringmCategoryNamethe category of the eventprivate LevelmLevelthe priority (level) of the eventprivate java.lang.StringmLocationDetailsthe location details for the eventprivate java.lang.StringmMessagethe msg for the eventprivate MyTableModelmModelwhere to put the eventsprivate java.lang.StringmNDCthe NDC for the eventprivate intmNumEventsthe number of events in the documentprivate java.lang.StringmThreadNamethe thread for the eventprivate java.lang.String[]mThrowableStrRepthe throwable details the eventprivate longmTimeStampthe time of the eventprivate static java.lang.StringTAG_EVENTrepresents the event tagprivate static java.lang.StringTAG_LOCATION_INFOrepresents the location info tagprivate static java.lang.StringTAG_MESSAGErepresents the message tagprivate static java.lang.StringTAG_NDCrepresents the ndc tagprivate static java.lang.StringTAG_THROWABLErepresents the throwable tag
-
Constructor Summary
Constructors Constructor Description XMLFileHandler(MyTableModel aModel)Creates a newXMLFileHandlerinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddEvent()Add an event to the modelvoidcharacters(char[] aChars, int aStart, int aLength)voidendElement(java.lang.String aNamespaceURI, java.lang.String aLocalName, java.lang.String aQName)(package private) intgetNumEvents()private voidresetData()Reset the data for an eventvoidstartDocument()voidstartElement(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 newXMLFileHandlerinstance.- Parameters:
aModel- where to add the events
-
-
Method Detail
-
startDocument
public void startDocument() throws org.xml.sax.SAXException- Specified by:
startDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
startDocumentin 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:
charactersin interfaceorg.xml.sax.ContentHandler- Overrides:
charactersin 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:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin 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:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin 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
-
-