Hello People,
I hope you can help me with this problem. I need to write a
java program that reads log files for real time reporting. So these are the catches:
1. The java program needs to run in a linux VM
2. The program should read files from directories in multiple hierarchies
for e.g., My original application writes log files in the following manner: For every transaction, it creates files.
The Directory structure looks like this Application Log Folder 1...n > Year > Month > Day > Hour of the Day > (and it creates new files for every transactions). For next day, it does the same, except it does not create new high level hierarchies of folder but it just moves on inside the old ones like this Year > Month > Next Day > Hour of the Day
Hope I better explained my file structure
My java program has to read every log file for every transaction. Look for a
string in every line of the log file and if it finds it, it copies the line and writes the line to a different single file (the program needs to create an output file every day for transactions of a single day)
Now, I know its quite easy to read a file, read every line, look for a string and copy the line over to an output file. But, how do I tackle the directory structures? (It could vary based on application). How can I make this real time so the data is written into the output file after every transaction completes (iow, after every log file is created)
Thanks in Advance
wicke