Perl and tail -f error_log

Discussion in 'Perl Misc' started by Bill H, Mar 13, 2009.

  1. Bill H

    Bill H Guest

    I use tail -f to watch for errors in scripts but sometimes it is hard
    to see the errors because other programmers may have scripts
    generating errors. Is there anyway in perl to have something show in
    the error log without actually generating an error?

    What I would like to be able to do is have something like

    Program foo.pl started
    any errors here
    Program foo.pl ended

    where foo.pl would put the started and ended line in the error log.

    FYI these are not terminal errors I am watching for, but warnings from
    pdf::api2 about invalid parameters being used

    Bill H
    Bill H, Mar 13, 2009
    #1
    1. Advertising

  2. >>>>> "Bill" == Bill H <> writes:

    Bill> I use tail -f to watch for errors in scripts but sometimes it is hard
    Bill> to see the errors because other programmers may have scripts
    Bill> generating errors. Is there anyway in perl to have something show in
    Bill> the error log without actually generating an error?

    Bill> What I would like to be able to do is have something like

    Bill> Program foo.pl started
    Bill> any errors here
    Bill> Program foo.pl ended

    Bill> where foo.pl would put the started and ended line in the error log.

    Bill> FYI these are not terminal errors I am watching for, but warnings from
    Bill> pdf::api2 about invalid parameters being used

    warn "started";
    ....
    warn "ended";


    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    <> <URL:http://www.stonehenge.com/merlyn/>
    Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
    See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
    Randal L. Schwartz, Mar 13, 2009
    #2
    1. Advertising

  3. Bill H

    Bill H Guest

    On Mar 13, 6:30 pm, Big and Blue <> wrote:
    > Bill H wrote:
    > > I use tail -f to watch for errors in scripts but sometimes it is hard
    > > to see the errors because other programmers may have scripts
    > > generating errors.

    >
    > Why would other programmers' scripts be generating errors on your screen?
    >
    >  >                    Is there anyway in perl to have something show in
    >
    > > the error log without actually generating an error?

    >
    > What error log?  Are you, by any chance, running your script on a Web server?  If so, try debugging
    > the script from a terminal/command line, rather than in a Web browser (i.e. debug the logic, not the
    > script).
    >
    > --
    >               Just because I've written it doesn't mean that
    >                    either you or I have to believe it..


    HI, yeah on a web server. I have debugged it locally and in terminal
    as much as possible, but now it interacts with flash and php so I have
    to watch the error log to see if things did not work right.

    Bill H
    Bill H, Mar 13, 2009
    #3
  4. Bill H <> wrote:
    >On Mar 13, 6:30 pm, Big and Blue <> wrote:
    >> What error log?  Are you, by any chance, running your script on a Web server?  If so, try debugging
    >> the script from a terminal/command line, rather than in a Web browser (i.e. debug the logic, not the
    >> script).

    >
    >HI, yeah on a web server. I have debugged it locally and in terminal
    >as much as possible, but now it interacts with flash and php so I have
    >to watch the error log to see if things did not work right.


    Normally you would further test and debug the script in an isolated test
    environment, exactly to prevent interference from unrelated other
    programs as well as to not break the production environment with not
    fully tested code.

    However, if you are taking shortcuts and are pushing unfinished code
    into production then just prepend all your own error and status messages
    with the name of your program. Then filtering the error log for your
    messages becomes trivial.

    jue
    Jürgen Exner, Mar 14, 2009
    #4
    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. Frank D. Greco

    Swing, tail -f and threading

    Frank D. Greco, May 29, 2004, in forum: Java
    Replies:
    3
    Views:
    1,066
    Thomas Weidenfeller
    Jun 2, 2004
  2. Stephen Thorne
    Replies:
    1
    Views:
    298
    Jack Diederich
    Aug 30, 2004
  3. Dmitry Maksyoma

    mod_ruby/eruby & apache error_log

    Dmitry Maksyoma, May 14, 2005, in forum: Ruby
    Replies:
    0
    Views:
    102
    Dmitry Maksyoma
    May 14, 2005
  4. Terry Michaels

    Tail Call Optimization (Tail Recursion)

    Terry Michaels, Apr 18, 2011, in forum: Ruby
    Replies:
    16
    Views:
    305
    Robert Klemme
    Apr 20, 2011
  5. PerlFAQ Server

    FAQ 5.33 How do I do a "tail -f" in perl?

    PerlFAQ Server, Mar 29, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    94
    PerlFAQ Server
    Mar 29, 2011
Loading...

Share This Page