+
+ isMissingLogFile = false;
+ Path debugfilePath = Paths.get(debuglogFile);
+ File debugfile = new File(debuglogFile);
+ debugStartFileSize = debugfile.length();
+ // start process debug.log file
+
+ Runnable runnable = new Runnable (){
+ boolean isStop = false;
+
+ public void run(){
+ while (!isStop){
+
+ if (debugfile.isFile()){
+ // log4jlogger must use .info
+ Stream<String> lines = null;
+ try {
+ lines = Files.lines(debugfilePath, Charset.defaultCharset()).onClose(() -> log4jlogger.info("Last-"+dataFileName+"-line-Read:" + debuglastNumberRead)).skip(debuglastNumberRead);
+ lines.forEachOrdered(line -> process(line, type, LOGTYPE.DEBUG));
+ } catch (IOException e) {
+ logger.error("Error processing line in " + dataFileName + ":" + e);
+ logger.error("break the loop.");
+ isStop = true;
+ }finally{
+ if(lines != null){
+ lines.close();
+ }
+ }
+ }
+ try {
+ Thread.sleep(sleepTimer);
+ debugStartFileSize = countLines(debuglogFile);
+ } catch (InterruptedException | IOException e) {
+ logger.error("Error processing line in " + dataFileName + ":" + e);
+ logger.error("break the loop.");
+ isStop = true;
+ }
+
+ logger.debug("File Line Count of debug.log: " + debugStartFileSize + " value read in: " + debuglastNumberRead);
+ if (debugStartFileSize < debuglastNumberRead ){
+ logger.debug("Failed Rolled: set Last number read to 0");
+ debuglastNumberRead = 0;
+ }
+ }
+ }
+ };
+
+ Thread thread = new Thread(runnable);
+ thread.start();
+
+ }
+ }catch(Exception e){
+ logger.error("Exception occured in DebugLogParser" +e);
+ }
+ }
+
+ private static void startErrorLogParser(File fileLog){
+ try{
+ if(errorlogFile != null && !errorlogFile.isEmpty()){
+
+ // pull the last line number
+ String dataFileName = "error.log";
+ String filesRead = PullLastLineRead(fileLog, dataFileName);
+ if (filesRead!= null){
+ filesRead = filesRead.replaceAll("(\\r\\n|\\n)", "<br />");
+ errorlastNumberRead= Integer.parseInt(filesRead.trim());
+ }else{
+ errorlastNumberRead = 0;
+ }
+
+ errorStartFileSize = countLines(errorlogFile);
+ if (errorStartFileSize < errorlastNumberRead ){
+ logger.error("Filed Rolled: set Last error number read to 0");
+ errorlastNumberRead = 0;