From: Stas Bekman Subject: Re: Logging at startup Date: 05:06 on 21 Dec 2004
Patrick LeBoutillier wrote:
> Hi all,> > I'm using the logging API ($s->notice("...")) in some code that is loaded> at startup> using PerlRequire.> > As mentionned in the docs on the Apache server cycle, my code is executed> twice.> The first time the code is executed, I see the log statements appear on> STDERR when> Apache is restarted (I use /etc/init.d/httpd restart).> > The problem is that I don't see the log statements in the Apache log file> for the second> execution. The logging seems to be disabled at this point.> > Is this normal / a know problem? Is there any way to get the logging to> work on the> second execution? My code does more stuff the second time around and I can't> see what's happening...
It's normal. Your code is running twice, but stderr is closed by Apache
during the restart's config and open_logs phases. it's reopen for the
post_config phase.
In Apache 2.0 one should avoid running startup code at config phase,
unless it's httpd.conf-specific. Instead post_config should be used. replace:
PerlRequire with PerlPostConfigRequire
http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlPostConfigRequire_
You will need the latest dev version to get this new feature:
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
I plan to write more docs explaining the issue.
> I'm using mod_perl 1.99_07-5 (latest version according to yum...) on> RedHat 9.0.> Maybe my version is too old....
Your version is *very* old (like 2+ years old), but this particular issue
will be still there. It's an Apache issue/feature.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.orgmailto:stas@xxxxxx.xxxhttp://use.perl.orghttp://apacheweek.comhttp://modperlbook.orghttp://apache.orghttp://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html