I am trying to design Log File Parser for my application. I have thousands of Log files having same pattern of data and my objective is to first parse the data and store it in a database.
Log file has following pattern-
a=some_value_1 b=some_value_2 c=some_value_3 d=some_value_4
a=some_value_5 b=some_value_6 c=some_value_7 d=some_value_8
a=some_value_9 b=some_value_10 c=some_value_11 d=some_value_12
a=some_value_13 b=some_value_14 c=some_value_15 d=some_value_16
My initial idea is to read all the files line by line using InputStreamReader and for every file in every line pick the data and fetch it to db. Seems good for some files but performance wise i need to improve my design. Can somebody suggest some better design model/architecture for the same?
I suggest that it will be better to use
BufferedReaderinstead ofInputStreamReader. The parsing part of your task does not seem very hard now.