java - file descriptor written in xml -


I am looking to parse the log files (text files are usually delimited by some characters), and I I want to do this work can create a parser that can take in an XML file that describes the format of the log file. In this way I can feed any type of log file to my parsers and my XML details with my parser and to remove useful information. I'm not sure how to describe the log file format normally in the XML file. Apart from this, I have uncertainty about the details of the details given in my log file. I appreciate any help and guidance on this.

  & lt; Logfile location = "/ usr / local / log / logfile.log" & gt; & Lt; Delimiter & gt; # & Lt; / Delimiter & gt; & Lt; Format & gt; & Lt; Field index = "1" length = "10" & gt; & Lt; Goal & gt; Date & lt; / Target & gt; & Lt; / Region & gt; & Lt; Field index = "2" & gt; & Lt; Goal & gt; Message & lt; / Target & gt; & Lt; / Region & gt; & Lt; Field index = "3" length = "20" & gt; & Lt; Goal & gt; Component & lt; / Target & gt; & Lt; / Region & gt; & Lt; Field index = "5" length = "20" & gt; & Lt; Goal & gt; Details & lt; / Target & gt; & Lt; / Region & gt; & Lt; / Format & gt; & Lt; / Logfile & gt;   

Your code reads this XML and dynamically parses each row in the log file according to the rules defined here. The program will then store the values ​​in the appropriate 'target' areas.

Log file:

  2012/12/12 10.10.10 # Important Application Status # Error in XYZ # Waste Information # Useful Information   

Output:

  Date: 2012/12/12 Message: Important Application state component: Error in component XYZ: Useful information    

Comments