Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Tailing a log file?

Reply
Thread Tools

Tailing a log file?

 
 
Evan Klitzke
Guest
Posts: n/a
 
      06-22-2007
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!

--
Evan Klitzke <(E-Mail Removed)>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Tailing a log file? Kenji Noguchi Python 2 06-22-2007 08:33 PM
Removing the leading and tailing blanks jalkadir C++ 6 10-15-2005 03:34 AM
tailing a log file using c ... Tony Stock C Programming 10 11-21-2003 04:38 PM
Need help on the Permissions needed to log to Event Log from ASP.NET? Henrik_the_boss ASP .Net 0 11-05-2003 10:14 AM
win32: 'Tailing' the NT event log using pipes? lebo Python 0 09-18-2003 12:14 AM



Advertisments