I’m looking for the least impacting method to read a few different log files. By ‘least impacting’ I mean the read wont affect log rotation, wont cause undue I/O activity, etc. I’m looking to accomplish this with Java…
Google afforded me the following little snippit of code:
FileStream fs = new FileStream('C:\foo.txt', FileMode.Open,FileAccess.Read, FileShare.ReadWrite);
This should be failry trivial to implement, but, I’m none too sure of my Java ‘cut and paste’ abilities and would like to know if there is a much better way to do this. The big picture here is to troll some apache and tomcat logs looking for a few key entries based on application activity and take some action based on the entry. Anyway, any tips? Thank you!
Pick one from here
🙂
I haven’t try them all but there are some useful comments from Jon Skeet on how not to do it.
My bet will be for the nio one.
See details in that question.