Fields Summary |
---|
private static final String | TAG_EVENTrepresents the event tag |
private static final String | TAG_MESSAGErepresents the message tag |
private static final String | TAG_NDCrepresents the ndc tag |
private static final String | TAG_THROWABLErepresents the throwable tag |
private static final String | TAG_LOCATION_INFOrepresents the location info tag |
private final MyTableModel | mModelwhere to put the events |
private int | mNumEventsthe number of events in the document |
private long | mTimeStampthe time of the event |
private Level | mLevelthe priority (level) of the event |
private String | mCategoryNamethe category of the event |
private String | mNDCthe NDC for the event |
private String | mThreadNamethe thread for the event |
private String | mMessagethe msg for the event |
private String[] | mThrowableStrRepthe throwable details the event |
private String | mLocationDetailsthe location details for the event |
private final StringBuffer | mBufbuffer for collecting text |
Methods Summary |
---|
private void | addEvent()Add an event to the model
mModel.addEvent(new EventDetails(mTimeStamp,
mLevel,
mCategoryName,
mNDC,
mThreadName,
mMessage,
mThrowableStrRep,
mLocationDetails));
mNumEvents++;
|
public void | characters(char[] aChars, int aStart, int aLength)
mBuf.append(String.valueOf(aChars, aStart, aLength));
|
public void | endElement(java.lang.String aNamespaceURI, java.lang.String aLocalName, java.lang.String aQName)
if (TAG_EVENT.equals(aQName)) {
addEvent();
resetData();
} else if (TAG_NDC.equals(aQName)) {
mNDC = mBuf.toString();
} else if (TAG_MESSAGE.equals(aQName)) {
mMessage = mBuf.toString();
} else if (TAG_THROWABLE.equals(aQName)) {
final StringTokenizer st =
new StringTokenizer(mBuf.toString(), "\n\t");
mThrowableStrRep = new String[st.countTokens()];
if (mThrowableStrRep.length > 0) {
mThrowableStrRep[0] = st.nextToken();
for (int i = 1; i < mThrowableStrRep.length; i++) {
mThrowableStrRep[i] = "\t" + st.nextToken();
}
}
}
|
int | getNumEvents()
return mNumEvents;
|
private void | resetData()Reset the data for an event
mTimeStamp = 0;
mLevel = null;
mCategoryName = null;
mNDC = null;
mThreadName = null;
mMessage = null;
mThrowableStrRep = null;
mLocationDetails = null;
|
public void | startDocument()
mNumEvents = 0;
|
public void | startElement(java.lang.String aNamespaceURI, java.lang.String aLocalName, java.lang.String aQName, org.xml.sax.Attributes aAtts)
mBuf.setLength(0);
if (TAG_EVENT.equals(aQName)) {
mThreadName = aAtts.getValue("thread");
mTimeStamp = Long.parseLong(aAtts.getValue("timestamp"));
mCategoryName = aAtts.getValue("logger");
mLevel = Level.toLevel(aAtts.getValue("level"));
} else if (TAG_LOCATION_INFO.equals(aQName)) {
mLocationDetails = aAtts.getValue("class") + "."
+ aAtts.getValue("method")
+ "(" + aAtts.getValue("file") + ":" + aAtts.getValue("line")
+ ")";
}
|