commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Ciarlillo <ac251...@gmail.com>
Subject Using org.apache.commons.io.input.Tailer with improperly rotated logs
Date Tue, 25 Jan 2011 19:51:04 GMT
I am trying to use this component to monitor a log file and import lines
into a database in (near) real-time. The problem that I am having is that
the software in question is Windows based and does not rotate logs like
other software, especially in Linux, does. The logs are rotated at 12:02am,
and the rotation occurs by renaming the current log file and creating a new
file with the same name. So SOME.LOG becomes SOME_YESTERDAY.LOG and a new
SOME.LOG is created.

The problem is while my process is running, Tailer has a handle to the file
and then it cannot be renamed. I understand this is not a limitation or
problem with the Tailer component, it is an issue with the software I am
monitoring, but I was looking for suggestions on how to work around this. I
have a few ideas of how this might work, mainly only opening the file for
Tailing every X seconds or so which will introduce some, but minimal,
overhead. My big fear however is missing something that is logged at say
12:01:59am using this approach. So I thought I would ask here and get some
input or opinions on approaches to this. Maybe someone else has had a
similar problem.

Thanks,
-ac

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message