messages to stderr behaving differently
z user <z2user-/[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, i am facing a weird problem with warn messages in my fast cgi perl program.
I am using apache 1.3.35 / mod_fastcgi-2.4.2 / perl 5.8.5
In my script, at the beginning i define a warn handler, and later use warns throughout my app. The code is like..
$SIG{__WARN__} = \&warn_handler;
use constant MAX_MSGLEN => 1022;
sub warn_handler
{
my $msg = join "", @_;
# print to STDERR
$msg = "[" . "$$|" . time2iso() . "] " . $msg;
# send in chunks, if necessary
while (length $msg > MAX_MSGLEN) {
my $chunk = substr($msg, 0, MAX_MSGLEN);
$msg = substr($msg, MAX_MSGLEN);
warn $chunk, "\n";
}
warn $msg;
}
The weird thing is, some of the warn messages
contain only the message i printed, ie if in my
program i had a message like
warn "err message going to log", i would get just
the following line in the log
[6125|2006-08-17 17:12:33] err message going to log
which is fine. But sometimes
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 17:12:33 2006] [error] [client 12.12.42.12] [6125|2006-08-17 17:12:33] err message going to log
so i imagine, some messages 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 weird behaviour, and suggest a remedy,
so that the err messages in STDERR does not have the datetime + ip prefix ?
thanks
---------------------------------
Get your email and more, right on the new Yahoo.com
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/