Tailing a log file?

E

Evan Klitzke

Everyone,

I'm interested in writing a python program that reads from a log file
and then executes actions based on the lines. I effectively want to
write a loop that does something like this:

while True:
log_line = log_file.readline()
do_something(log_line)

Where the readline() method blocks until a new line appears in the
file, unlike the standard readline() method which returns an empty
string on EOF. Does anyone have any suggestions on how to do this?
Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top