http://www.perlmonks.org?node_id=607337

artemave has asked for the wisdom of the Perl Monks concerning the following question:

Hi, monks.

I've just started to explore mod_perl and have some questions (possibly stupid):
1. How do I run single process mode?
2. Why there are no messages in error log on calling warn?
3. What are the the best debugging technincs?

I've WinXP with mod_perl 2.0

Regards,
Artem.

Replies are listed 'Best First'.
Re: mod_perl questions
by perrin (Chancellor) on Mar 29, 2007 at 20:26 UTC
    Single process mode is usually started by calling httpd with a -X parameter. If you don't see warn output in the error_log, it's either not getting to your warn statement or you're looking in the wrong error_log. You might be interested in this book, which you can read on-line or buy on paper.
      > Single process mode is usually started by calling httpd with a -X parameter

      This I know, but on Windows apache is controlled as service. Any idea how to tell the service to run a single mode?

      > If you don't see warn output in the error_log, it's either not getting to your warn statement
      package Apache2::Hello; use strict; use warnings; use Apache2::RequestRec(); # for $r->content_type use Apache2::RequestIO(); # for $r->puts use Apache2::Const qw/:common/; use Apache2::Reload; sub handler { my $r = shift; my $time = scalar localtime(); my $package = __PACKAGE__; $r->content_type('text/html'); warn 'darn'; $r->puts(<<"END"); <HTML><BODY> <H3>Hello</H3> Hello from <B>$package</B>! The time is $time. </BODY></HTML> END return Apache2::Const::OK; } 1;
      You think?

      > or you're looking in the wrong error_log

      There is only one I know. Configured by ErrorLog parameter in httpd.conf
      Besides, die messages go there as they should.

      Thanks,
      Artem.
        Have you confirmed that the handler code you showed is getting run? Is there any chance you have more than one apache installed on your system? Another possibility is that you might have changed the LogLevel setting from its default.

        I can't help you with the Windows service question since I don't use Windows. I'd suggest you check the docs that came with your build or ask on the mod_perl list. Randy Kobes is pretty good about helping out Windows users on the list.

Re: mod_perl questions
by adrianh (Chancellor) on Apr 01, 2007 at 08:12 UTC
    Why there are no messages in error log on calling warn?

    In your httpd.conf is LogLevel set to at least "warn"?