You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Pierre Forget <pi...@st-donat.com> on 2013/03/20 01:29:56 UTC

[users@httpd] Errorlog for cgi and Perl

Hi,

I installed Apache 2.4.3  with vhosts and in the httpd.conf, for each 
vhost,  I have the usual CustomLog and  Errorlog directive:

CustomLog "/httpd/domainname/logs/access_log" combined
Errorlog "/httpd/domainname/logs/error_log"

The CustomLog results go to the folder indicated as usual (in each 
vhost folder), but the Errorlog is reacting bizarre.

If I make a voluntary error in my Perl script, I get in the 
/httpd/domainname/logs/error_log:

[Tue Mar 19 20:19:25.500222 2013] [cgid:error] [pid 17263:tid 
2921331520] [client 24.122.245.237:56995] End of script output before 
headers: testerreur.pl

And in the Apache error log 
(/httpd/usr/local/apache2/logs/error_log), I get the real error 
message that I need:

syntax error at testerreur.pl line 43, near ","

Problem is that I want the error logging to go the local folder of 
each vhost (which is what is happening on my other servers with 
previous versions of Apache).

Much easier to debug a Perl script when the logs go into each vhost 
folder instead of going in a global error log file.

Also, If I make a minor Mysql error in the Perl script, I get no 
message in the vhost folder error file, but I still get the error (or 
warning) in the global Apache error log file.

Any idea where I can search?

BTW, I treid to use:

ErrorLog "/httpd/domainname/logs/error_log"

instead of

Errorlog "/httpd/domainname/logs/error_log"

No joy...

Thank you in advance,

Pierre Forget




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Errorlog for cgi and Perl

Posted by Pete Houston <ph...@openstrike.co.uk>.
On Tue, Mar 19, 2013 at 08:29:56PM -0400, Pierre Forget wrote:
> If I make a voluntary error in my Perl script, I get in the
> /httpd/domainname/logs/error_log:
> 
> [Tue Mar 19 20:19:25.500222 2013] [cgid:error] [pid 17263:tid
> 2921331520] [client 24.122.245.237:56995] End of script output
> before headers: testerreur.pl
> 
> And in the Apache error log
> (/httpd/usr/local/apache2/logs/error_log), I get the real error
> message that I need:
> 
> syntax error at testerreur.pl line 43, near ","

This suggests that you might be running either worker or event MPM
in your new installation as opposed to prefork in your older ones. The
threaded MPMs use mod_cgid instead of mod_cgi with the type of side-effect
regarding the error logs which you describe.

Is that the case?

Pete
-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107

Re: [users@httpd] Errorlog for cgi and Perl

Posted by Pierre Forget <pi...@st-donat.com>.
Hi,

Thank you very much, I finally got back my logs at the right place 
recompiling with:

--with-mpm=prefork --enable-cgi

  I find it odd that the newer version cannot get the logs at the 
right place. If you have many vhost, it must be a nightmare to have 
all the logs in the same file.

Unless you pipe it to another program to get it filtered, but I think 
this should be done in the first place by Apache. Am  I right in 
saying that? Or is it a new way to work? I don't understand that part.

I know you can use Carp and send them to the browser, but I prefer to 
have the logs internal, so, if I forget to remove the Carp directive 
in a file, it could bring some security issues.

Two thumbs up for Jeff Trawick and all who took the time to give advice.

Thanks again,

Pierre Forget





Re: [users@httpd] Errorlog for cgi and Perl

Posted by Eric Covener <co...@gmail.com>.
> Problem is that I want the error logging to go the local folder of each
> vhost (which is what is happening on my other servers with previous versions
> of Apache).

Are you running in perl as CGI, and did you change from mod_cgi to
mod_cgid when you moved to 2.4?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Errorlog for cgi and Perl

Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Mar 20, 2013 at 4:42 PM, Pierre Forget
<pi...@st-donat.com> wrote:
> Hi,
>
> In response to Pete Houston.
>
> Yes, I seem to use event. because httpd -l gives me:
>
> Compiled in modules:
>   core.c
>   mod_so.c
>   http_core.c
>   event.c
>
> And certainly mod_cgid because it is in the lines of httpd.conf and active.
>
> Can we go around the side effects of the logs, and get the logs to go in the
> right vhost folder?

Rebuild using

--with-mpm=prefork --enable-cgi

(along with your other configure options) and ensure that mod_cgi is
loaded and mod_cgid is not loaded.


>
> Thanks,
>
> Pierre Forget
>
>
>



-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Errorlog for cgi and Perl

Posted by Pierre Forget <pi...@st-donat.com>.
Hi,

In response to Pete Houston.

Yes, I seem to use event. because httpd -l gives me:

Compiled in modules:
   core.c
   mod_so.c
   http_core.c
   event.c

And certainly mod_cgid because it is in the lines of httpd.conf and active.

Can we go around the side effects of the logs, and get the logs to go 
in the right vhost folder?

Thanks,

Pierre Forget




Re: [users@httpd] Errorlog for cgi and Perl

Posted by Pierre Forget <pi...@st-donat.com>.
At 20:29 2013-03-19, you wrote:
>Hi,
>
>I installed Apache 2.4.3  with vhosts and in the httpd.conf, for 
>each vhost,  I have the usual CustomLog and  Errorlog directive:
>
>CustomLog "/httpd/domainname/logs/access_log" combined
>Errorlog "/httpd/domainname/logs/error_log"
>
>The CustomLog results go to the folder indicated as usual (in each 
>vhost folder), but the Errorlog is reacting bizarre.
>
>If I make a voluntary error in my Perl script, I get in the 
>/httpd/domainname/logs/error_log:
>
>[Tue Mar 19 20:19:25.500222 2013] [cgid:error] [pid 17263:tid 
>2921331520] [client 24.122.245.237:56995] End of script output 
>before headers: testerreur.pl
>
>And in the Apache error log 
>(/httpd/usr/local/apache2/logs/error_log), I get the real error 
>message that I need:
>
>syntax error at testerreur.pl line 43, near ","
>
>Problem is that I want the error logging to go the local folder of 
>each vhost (which is what is happening on my other servers with 
>previous versions of Apache).
>
>Much easier to debug a Perl script when the logs go into each vhost 
>folder instead of going in a global error log file.
>
>Also, If I make a minor Mysql error in the Perl script, I get no 
>message in the vhost folder error file, but I still get the error 
>(or warning) in the global Apache error log file.
>
>Any idea where I can search?
>
>BTW, I treid to use:
>
>ErrorLog "/httpd/domainname/logs/error_log"
>
>instead of
>
>Errorlog "/httpd/domainname/logs/error_log"
>
>No joy...
>
>Thank you in advance,
>
>Pierre Forget
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>

Hi,

Yes, I am using mod_cgid as per httpd.conf:

LoadModule cgid_module modules/mod_cgid.so

But, I don't see any reference to worker or MPM in the httpd.conf. If 
I understand right, those are modules, so they should have a module 
line in httpd.conf to get loaded.

Here is the config.nice file that was generated at compile time:

"./configure" \
"--prefix=/httpd/usr/local/apache2" \
"--enable-suexec" \
"--with-suexec-caller=WWW" \
"--with-suexec-docroot=/httpd" \
"--with-suexec-gidmin=100" \
"--with-suexec-logfile=/var/log/apache2/suexec_log" \
"--with-suexec-safepath=/usr/local/bin:/usr/bin:/bin" \
"--with-suexec-userdir=HTML" \
"--with-suexec-uidmin=500" \
"--with-suexec-umask=077" \
"--with-suexec-bin=/usr/sbin/suexec2" \
"--with-perl=/usr/bin/perl" \
"--with-expat=/usr" \
"--with-ssl=/usr/bin" \
"--with-z=/usr" \
"--with-port=80" \
"--with-program-name=apache2" \
"--with-devrandom=/dev/urandom" \
"--enable-module=usertrack" \
"--enable-module=log_referer" \
"--enable-module=expires" \
"--enable-module=rewrite" \
"--enable-module=speling" \
"--enable-module=so" \

Is there any way I can get to log in the right folder?

Thanks,

Pierre Forget