Tailing a log file?

Discussion in 'Python' started by Evan Klitzke, Jun 22, 2007.

  1. Evan Klitzke

    Evan Klitzke Guest

    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 <>
    Evan Klitzke, Jun 22, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Stock

    tailing a log file using c ...

    Tony Stock, Nov 20, 2003, in forum: C Programming
    Replies:
    10
    Views:
    682
    CBFalconer
    Nov 21, 2003
  2. lebo
    Replies:
    0
    Views:
    340
  3. jalkadir
    Replies:
    6
    Views:
    422
    jalkadir
    Oct 15, 2005
  4. Kenji Noguchi

    Re: Tailing a log file?

    Kenji Noguchi, Jun 22, 2007, in forum: Python
    Replies:
    2
    Views:
    357
  5. SamXiao

    Tailing a series of log files

    SamXiao, Jun 12, 2013, in forum: Java
    Replies:
    8
    Views:
    251
    Arved Sandstrom
    Jun 16, 2013
Loading...

Share This Page