RE: [mp2] LogHandler configuration problems
Hi Stas - ...look at the error log... For the first test, which my logger reported: ::1 [Wed Dec 4 19:58:13 2002] / 404 266 ::1 [Wed Dec 4 19:58:24 2002] /index.html 403 280 ::1 [Wed Dec 4 19:58:45 2002] /perl/rocks.html 200 29 The error log reported: [Wed Dec 04 19:58:13 2002] [error] [client ::1] Attempt to serve directory: /srv/www/htdocs/ [Wed Dec 04 19:58:24 2002] [error] file permissions deny server execution/srv/www/htdocs/index.html I don't see that these error_log entries ...revealed the problem right away, from the first test... To me, newbie that I am, they give abount the same information that my logger gave... OK, I'll relax. The secret is to read and test more before crying wolf, Aloha = Beau. -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 9:23 PM To: Beau E. Cox Cc: Modperl Subject: Re: [mp2] LogHandler configuration problems Beau E. Cox wrote: Well Stas, you asked for it... :) [...] #---mod_perl 2.0 rocks test- Alias /perl/ /srv/www/conf/perl/ Location /perl/ SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location #---MyApache-FileLogger- Location / SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlLogHandler MyApache::FileLogger Options +ExecCGI /Location As you have figured out by trial and error, if you wanted the logger to work for everything you just needed to add: Location / PerlLogHandler MyApache::FileLogger /Location what you originally did, is assigned ModPerl::Registry to serve everything on the server, but fed it with html and images, forgetting that it requires a Perl diet. Since you've repeated many times that you are a newbie, I'll forgive you ;) But if you weren't a newbie and you didn't remember to check the error_log file, I'd say: shame on you :) As the latter would have revealed the problem right away, from the first test. Notice that my example configuration is correct since it demonstrates the use of a logger for a particular sub-section of the site that *happens* to be served by the ModPerl::Registry handler. Perhaps that example needs some extra notes to avoid this kind of confusion in the future. I'll add a note. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [mp2] LogHandler configuration problems
Beau E. Cox wrote: Hi Stas - ...look at the error log... For the first test, which my logger reported: ::1 [Wed Dec 4 19:58:13 2002] / 404 266 ::1 [Wed Dec 4 19:58:24 2002] /index.html 403 280 ::1 [Wed Dec 4 19:58:45 2002] /perl/rocks.html 200 29 The error log reported: [Wed Dec 04 19:58:13 2002] [error] [client ::1] Attempt to serve directory: /srv/www/htdocs/ [Wed Dec 04 19:58:24 2002] [error] file permissions deny server execution/srv/www/htdocs/index.html I don't see that these error_log entries ...revealed the problem right away, from the first test... To me, newbie that I am, they give abount the same information that my logger gave... bummer ;) I was sure that registry will complain in the logs, but forgot that Apache got on its way. So you were right and I wrong ;) Glad that you've figured it out. OK, I'll relax. The secret is to read and test more before crying wolf you'd be surprised how many times i've cried wolf myself... even did that, this morning ;) __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
[mp2] LogHandler configuration problems
Well Stas, you asked for it... :) -8-- Start Bug Report 8-- 1. Problem Description: LogHandler configuration problem. In the tests below I start out with the LogHandler configuration in the documentation and keep 'trimming' it down until it works. I'm almost (not 100%) sure the problem has something with the way I'm configured, but, being a newwbi, I can't see it. This is low-priority; I have it working fine, I'm just trying to understand what's going on. Oh, almost forgot, ALL files are set to mywebuser:mywebgroup as defined in the User/Group httpd.conf directives. A. startup.pl (remains the same for all tests below) use Apache2 (); use lib qw(/srv/www/conf/perl); use ModPerl::Util (); #for CORE::GLOBAL::exit use Apache::RequestRec (); use Apache::RequestIO (); use Apache::RequestUtil (); use Apache::Server (); use Apache::ServerUtil (); use Apache::Connection (); use Apache::Log (); use APR::Table (); use ModPerl::Registry (); use Apache::Const -compile = ':common'; use APR::Const -compile = ':common'; 1; B. 'default' page setting in httpd.conf (same for all) DirectoryIndex index.html index.html.var C. my log handler (same for all) package MyApache::FileLogger; use strict; use warnings; use Apache::RequestRec (); use Apache::Connection (); use Fcntl qw(:flock); use Apache::Const -compile = qw(OK DECLINED); sub handler { my $r = shift; my $entry = sprintf qq(%s [%s] %s %d %d\n), $r-connection-remote_ip, scalar(localtime), $r-uri, $r-status, $r-bytes_sent; my $log_path = Apache::server_root_relative($r-pool, logs/filelogger.log); open my $fh, $log_path or die can't open $log_path: $!; flock $fh, LOCK_EX; print $fh $entry; close $fh; return Apache::OK; } 1; C1. /perl/rocks.html #!/usr/bin/perl print Content-type: text/html\n\n; print h3mod_perl 2.0 rocks!/h3\n; D. test 1 ---httpd.conf--- LoadModule perl_module modules/mod_perl.so PerlRequire /srv/www/conf/perl/startup.pl #---mod_perl 2.0 rocks test- Alias /perl/ /srv/www/conf/perl/ Location /perl/ SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location #---MyApache-FileLogger- Location / SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlLogHandler MyApache::FileLogger Options +ExecCGI /Location ---log--- ::1 [Wed Dec 4 19:58:13 2002] / 404 266 ::1 [Wed Dec 4 19:58:24 2002] /index.html 403 280 ::1 [Wed Dec 4 19:58:45 2002] /perl/rocks.html 200 29 localhost - not found (DirectoryIndex not followed) localhost/index.html - premission nixed localhost/perl/rocks.html - OK E. test 2 ---httpd.conf--- LoadModule perl_module modules/mod_perl.so PerlRequire /srv/www/conf/perl/startup.pl #---mod_perl 2.0 rocks test- Alias /perl/ /srv/www/conf/perl/ Location /perl/ SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location #---MyApache-FileLogger- Location / SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlLogHandler MyApache::FileLogger # Options +ExecCGI /Location ---log--- ::1 [Wed Dec 4 20:12:43 2002] / 404 266 ::1 [Wed Dec 4 20:12:49 2002] /index.html 403 280 ::1 [Wed Dec 4 20:12:59 2002] /perl/rocks.html 200 29 F. test 3 ---httpd.conf--- LoadModule perl_module modules/mod_perl.so PerlRequire /srv/www/conf/perl/startup.pl #---mod_perl 2.0 rocks test- Alias /perl/ /srv/www/conf/perl/ Location /perl/ SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location #---MyApache-FileLogger- Location / SetHandler perl-script # PerlResponseHandler ModPerl::Registry PerlLogHandler MyApache::FileLogger # Options +ExecCGI /Location ---log--- ::1 [Wed Dec 4 20:17:30 2002] / 404 266 ::1 [Wed Dec 4 20:17:47 2002] /index.html 200 1495 ::1 [Wed Dec 4 20:17:47 2002] /apache_pb.gif 200 2326 ::1 [Wed Dec 4 20:17:56 2002] /perl/rocks.html 200 29 well, some progress... G. test 4 ---httpd.conf--- LoadModule perl_module
Re: [mp2] LogHandler configuration problems
Beau E. Cox wrote: Well Stas, you asked for it... :) [...] #---mod_perl 2.0 rocks test- Alias /perl/ /srv/www/conf/perl/ Location /perl/ SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI /Location #---MyApache-FileLogger- Location / SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlLogHandler MyApache::FileLogger Options +ExecCGI /Location As you have figured out by trial and error, if you wanted the logger to work for everything you just needed to add: Location / PerlLogHandler MyApache::FileLogger /Location what you originally did, is assigned ModPerl::Registry to serve everything on the server, but fed it with html and images, forgetting that it requires a Perl diet. Since you've repeated many times that you are a newbie, I'll forgive you ;) But if you weren't a newbie and you didn't remember to check the error_log file, I'd say: shame on you :) As the latter would have revealed the problem right away, from the first test. Notice that my example configuration is correct since it demonstrates the use of a logger for a particular sub-section of the site that *happens* to be served by the ModPerl::Registry handler. Perhaps that example needs some extra notes to avoid this kind of confusion in the future. I'll add a note. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com