On Dec 2, 8:53 am, viksit <vik...@gmail.com> wrote:
> Hi all,
>
> What would you recommend as the best method to tail a file using
> Clojure? Are there any built in functions in contrib or core that
> allow a program to read the last line of a file as it is appended to?
> If not - how do people solve a problem like this?
>
> My aim is simple - I've got a log file and I'd like to parse it as it
> gets appended to.
>

I have had to do this in the past and I use unix commands:

https://gist.github.com/726875

The code above runs a unix command in a separate thread and executes a
given function, f, on a sequence of output lines. It handles restarts
if the command gets killed by a log rotation.

For the actual tail command I'd recommend looking at a recent version
of GNU tail or install inotail - a filewatching API which makes these
commands much more efficient:

http://distanz.ch/inotail/

Saul

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to