Perl and tail -f error_log

B

Bill H

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
 
R

Randal L. Schwartz

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";
 
B

Bill H

Why would other programmers' scripts be generating errors on your screen?

 >                    Is there anyway in perl to have something show in


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.

Bill H
 
J

Jürgen Exner

Bill H said:
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
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top