private void decodeEvents(final Document document,LogDataCollector collector,ParsingContext parsingContext){
  NodeList eventList=document.getElementsByTagName("record");
  for (int eventIndex=0; eventIndex < eventList.getLength(); eventIndex++) {
    Node eventNode=eventList.item(eventIndex);
    Logger logger=null;
    long timeStamp=0L;
    Level level=null;
    String threadName=null;
    Object message=null;
    String className=null;
    String methodName=null;
    String exceptionStackTrace=null;
    NodeList list=eventNode.getChildNodes();
    int listLength=list.getLength();
    if (listLength == 0) {
      continue;
    }
    for (int y=0; y < listLength; y++) {
      Node logEventNode=list.item(y);
      String tagName=logEventNode.getNodeName();
      if (tagName.equalsIgnoreCase("logger")) {
        logger=LoggerFactory.getLogger(getCData(list.item(y)));
      }
 else       if (tagName.equalsIgnoreCase("millis")) {
        timeStamp=Long.parseLong(getCData(list.item(y)));
      }
 else       if (tagName.equalsIgnoreCase("level")) {
        level=Level.parse(getCData(list.item(y)));
      }
 else       if (tagName.equalsIgnoreCase("thread")) {
        threadName=getCData(list.item(y));
      }
 else       if (tagName.equalsIgnoreCase("message")) {
        message=getCData(list.item(y));
      }
 else       if (tagName.equalsIgnoreCase("class")) {
        className=getCData(list.item(y));
      }
 else       if (tagName.equalsIgnoreCase("method")) {
        methodName=getCData(list.item(y));
      }
 else       if (tagName.equalsIgnoreCase("exception")) {
        exceptionStackTrace=getExceptionStackTrace(list.item(y));
      }
    }
    if (message != null && exceptionStackTrace != null) {
      message=message + "\n" + exceptionStackTrace;
    }
 else     if (exceptionStackTrace != null) {
      message=exceptionStackTrace;
    }
    LogData logData=new LogData();
    logData.setLevel(level);
    logData.setClazz(className);
    logData.setId(parsingContext.getGeneratedIdAndIncrease());
    logData.setDate(new Date(timeStamp));
    logData.setLoggerName(logger.getName());
    logData.setMessage(StringUtils.defaultString(message != null ? message.toString() : ""));
    logData.setThread(threadName);
    logData.setMethod(methodName);
    logData.setLogSource(parsingContext.getLogSource());
    collector.add(logData);
  }
}

private void decodeEvents ( final Document document , LogDataCollector collector , ParsingContext parsingContext ) { NodeList eventList = document . getElementsByTagName ( "record" ) ; for ( int eventIndex = 0 ; eventIndex < eventList . getLength ( ) ; eventIndex ++ ) { Node eventNode = eventList . item ( eventIndex ) ; Logger logger = null ; long timeStamp = 0L ; Level level = null ; String threadName = null ; Object message = null ; String className = null ; String methodName = null ; String exceptionStackTrace = null ; NodeList list = eventNode . getChildNodes ( ) ; int listLength = list . getLength ( ) ; if ( listLength == 0 ) { continue ; } for ( int y = 0 ; y < listLength ; y ++ ) { Node logEventNode = list . item ( y ) ; String tagName = logEventNode . getNodeName ( ) ; if ( tagName . equalsIgnoreCase ( "logger" ) ) { logger = LoggerFactory . getLogger ( getCData ( list . item ( y ) ) ) ; } else if ( tagName . equalsIgnoreCase ( "millis" ) ) { timeStamp = Long . parseLong ( getCData ( list . item ( y ) ) ) ; } else if ( tagName . equalsIgnoreCase ( "level" ) ) { level = Level . parse ( getCData ( list . item ( y ) ) ) ; } else if ( tagName . equalsIgnoreCase ( "thread" ) ) { threadName = getCData ( list . item ( y ) ) ; } else if ( tagName . equalsIgnoreCase ( "message" ) ) { message = getCData ( list . item ( y ) ) ; } else if ( tagName . equalsIgnoreCase ( "class" ) ) { className = getCData ( list . item ( y ) ) ; } else if ( tagName . equalsIgnoreCase ( "method" ) ) { methodName = getCData ( list . item ( y ) ) ; } else if ( tagName . equalsIgnoreCase ( "exception" ) ) { exceptionStackTrace = getExceptionStackTrace ( list . item ( y ) ) ; } } if ( message != null && exceptionStackTrace != null ) { message = message + "\n" + exceptionStackTrace ; } else if ( exceptionStackTrace != null ) { message = exceptionStackTrace ; } LogData logData = new LogData ( ) ; logData . setLevel ( level ) ; logData . setClazz ( className ) ; logData . setId ( parsingContext . getGeneratedIdAndIncrease ( ) ) ; logData . setDate ( new Date ( timeStamp ) ) ; logData . setLoggerName ( logger . getName ( ) ) ; logData . setMessage ( StringUtils . defaultString ( message != null ? message . toString ( ) : "" ) ) ; logData . setThread ( threadName ) ; logData . setMethod ( methodName ) ; logData . setLogSource ( parsingContext . getLogSource ( ) ) ; collector . add ( logData ) ; } }
given a document , converts the xml into a vector of loggingevents .
