fenLisesi has asked for the wisdom of the Perl Monks concerning the following question:
Humbled, as always, at your presence, I seek your wisdom on a problem that we are having, trying to maintain our web application on Windows systems. The following is a description of the issue that my colleague has put together.
Enabling mod_perl in my Win32 environment causes Perl warnings to disappear. Warnings from CORE and those from explicit "warn" api calls don't appear in error.log, although "die" messages do appear. There is no problem when operating in plain CGI mode. There is no problem with the application running on Linux, mod_perl or otherwise.
... ThreadsPerChild 100 MaxRequestsPerChild 0 ... ErrorLog logs/error.log ... LogLevel warn ...
messages are recorded in error.log. However, in order to have all STDERR messages (like, perl warnings etc.) recorded in error.log, i've tried*CORE::GLOBAL::warn = \&Apache2::ServerRec::warn;
But it doesn't work, maybe since alarms are not reliable in Win32.local $SIG{__WARN__} = \&Apache2::ServerRec::warn;
Apache's loglevel is "warn", (i verified that by inspecting loglevel at runtime by: $loglevel = $s->loglevel();)
Please have a look at the code segment below, when warn is redirected to mywarn
Each "warn" message appears twice as expected: first as a [warn], next as an [error]. So I shouldn't have a problem with LogLevel in httpd.conf, since warnings appear without a problem.use Apache2::Const -compile => qw(:log); use APR::Const -compile => qw(ENOTIME SUCCESS); *CORE::GLOBAL::warn = \&mywarn; sub mywarn { my @msg = @_; my $s = Apache2::ServerUtil->server; $s->log_serror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_WARNING, APR::Const::SUCCESS, @msg); $s->log_serror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_ERR, APR::Const::SUCCESS, @msg); }
How can I enable STDERR messages to appear in error.log in a Win32 environment?
I would prefer not to introduce such hacks to warn, carp etc either.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Warnings awol in Win32 mod_perl.
by glasswalk3r (Friar) on Apr 26, 2007 at 12:52 UTC | |
by fenLisesi (Priest) on Apr 26, 2007 at 13:03 UTC | |
|
Re: Warnings awol in Win32 mod_perl.
by Trizor (Pilgrim) on Apr 26, 2007 at 19:02 UTC |