Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error log file name

Status
Not open for further replies.

Kathy1

Programmer
Dec 21, 2000
39
US
Hi.

I hope this is an easy question. I've been trying to find the log file where my Perl errors (STDERR) are going. It is not being obvious. I can redirect them to my own specific error log files, but I need to know where they were going originally, before I redirected them. Is there a .dll file or something set in config.sys somewhere that will tell me where these were originally being written?

I have checked all the .log files on the server and found nothing that looks remotely like Perl error/informational messages.

Any help on this would be very much appreciated.

Thank you.

Kathy
 
Kathy, are you running Perl CGI scripts, or just regular Perl scripts at the command line?

I think the default for non-cgi scripts is for STDERR to come right back to the screen - same as STDOUT. But you can redirect STDERR when you invoke the script like this:

$ my_script.pl 2>my_errors.log

For cgi-scripts, your webserver's config file probably has a spot for saying where the error log is, and I believe that's where STDERR messages go when written from a cgi script. We use the Apache webserver, and in apache's httpd.conf, the directive ErrorLog gives the location of the error log, and that's where cgi STDERR messages go.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Note: STDERR will not be redirected with a[tt]
perl srcipt.pl > file.txt[/tt]
call. that only redirects STDOUT, so that any call to "die" or any time the script has compile/runtime errors, they'll go to the terminal. if you wanna redirect STDERR, you have to do it in the script.
well, this is only for non-cgi scripts. for cgi's, i've never seen the logfile, and i think apache interprets them herself, throws them away, and gives her own rendition in apache/log/error.log . to get at the errors my scripts are giving, i usually just run them on the command line. i have a dummy file with the form pairs and other environmental variables the cgi would get from an imaginary website, and do the following:[tt]
cat dummy.txt | perl script.pl > viewit.html[/tt]

now that i think of it, though, you should be able to set the apache server to include the cgi errors. maybe if you set the loglevel to Debug or Info? i don't know. i'll play with that.
hope i haven't been more confusing than helpful. "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Thank you HMerril and Stillflame.

The webserver I have is IIS, not Apache. I have checked the normal webserver log files, and the errors don't go there.

I also have already re-directed the errors using:

use CGI::Carp qw(carpout);
open(AUTOLOG, ">>autoaccviolcgi.log") or
die("Unable to open autoacviolcgi.log: $!\n");
carpout(AUTOLOG);

This code gives me a date/time stamp and a program name for errors, which you don't always get with just the regular STDERR errors. Redirecting the errors isn't a problem.

I am looking for config files that might indicate where Perl normally dumps its error messages. The errors that I see in my newly redirected .log files were never going to the screen. So, I need to know where they were going before I told them where to go. I haven't re-directed the error log to specific files for all the Perl programs in the system, and I really don't want to do that. I'd rather look at the log that Perl just normally uses instead of changing all the programs to use special log files.

These errors are usually 'informational' errors, not program-killing errors. I'm using the -w on the first line of code in my programs. So I get some 'extra' errors that should be cleaned up, but aren't normally life-threatening.

If it makes any difference, the server operating system is NT.


Thank you.

Kathy
 
I'm not going to be much help with NT - but normally on *nix, for scripts(including both shell and Perl scripts) run at the command line, both STDERR and STDOUT go back to the screen. I believe Perl just follows the STDOUT and STDERR that are already defined on your system - where they're defined I don't know, but I *don't* think Perl has it's own STDERR and STDOUT. Again, cgi STDERR is probably defined in the webserver configuration file.
Hardy Merrill
Mission Critical Linux, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top