Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read a continuously updated log file in scala

Tags:

scala

I want to read a continuously updated file as (tail -f) in scala, I can't use other tools such as tail because I need to do some extra processing on the records.

So how to keep track of exact file contents every time.

like image 903
Ankit Zalani Avatar asked Dec 25 '22 05:12

Ankit Zalani


1 Answers

There's an implementation of "tail -f" in Apache commons. http://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/input/Tailer.html
With google search, I found another implementation of "tail -f": https://github.com/alaz/tailf/blob/master/src/main/scala/com/osinka/tailf/Tail.scala

like image 51
ntn Avatar answered Jan 11 '23 11:01

ntn