What is the most efficient(fast and safe) way of reading a log file in java? The log file continuously(almost every second) gets updated.
Tricky, and depends on many variables, but you might want to take a look at BufferedReader and see if does what you need.
http://java.sun.com/j2se/1.4.2/docs/api/java/io/BufferedReader.html
Assuming you are talking about server logs then you might want to look at an existing tool like Splunk.
Looks like Apache JMeter (open source, friendly licensing) has some classes that you may be able to reuse which parse Tomcat access logs. Internally, these classes are used in JMeter for the Access Log Sampler which is a tool that simulates production traffic in development environments by parsing access logs and generating HTTP requests to a development web server based on the logs. You can probably reuse just the log parsing functionality for your own purposes.
If you just want to follow the output the "tail -f foobar.log" works well. If you are on a Windows machine, it is available with Cygwin. http://www.cygwin.com/.