Hello Monks, i am having a weird problem.
I have a fast cgi perl program running on
apache 1.3 / mod_fastcgi-2.4.2 / perl 5.6.1
At the beginning of the program i redirect STDERR, so as not to clutter /usr/local/apache/logs/error_log. I use the following code for doing this.
sub redirect_elog
{
my ($file) = @_;
local *LCSTDERR;
open(LCSTDERR, ">>$file") or
die "Can't open log file $file";
open(STDERR, ">&LCSTDERR") or
die "can't redirect standard error";
}
This works just fine.
When i use the same fastcgi perl program in another machine, but here using perl 5.8.5 the problem starts.
In this case some of the error messages are redirected to the file i specify and some others go to the main STDERR !!
ie /usr/local/apache/logs/error_log
This splitting of errors happens only with fastcgi and not with regular cgi scripts.
One more thing i noted was, when the warn messages land up in the file i specified, they contain only the message i printed, ie if in my program i had a message like
warn "err message going to log", in my redirected file i would get just the line "err message going to log" line,
while in the err messages that is being printed to /usr/local/apache/logs/error_log, ie STDERR, the message will have the usual apache errlog prefix of datetime + ip, ie i will have a message in the logs like
[Thu Aug 17 11:32:17 2006] [ error] [client 12.12.42.12] err message going to log
so i imagine, whatever messages are going to STDERR are going through apaches ap_log_error method wherin the date and ip are added to the msg
can anyone please throw some light on this, so that the err messages does not land up in STDERR ie /usr/local/apache/logs/error_log, but goes instead to the redirected log file
thanks very much
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.