Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Perl and Mysql logs

by PierreForget (Initiate)
on Mar 19, 2013 at 14:11 UTC ( #1024305=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl and Mysql logs
in thread Perl and Mysql logs

Hi and thank you for the reply.

The clientpreno is a voluntary mistake, so that the system will generate a Mysql error. Otherwise, the Perl script gets executed without generating any error. The purpose is to be able to get Mysql errors when there is an error in the code. Actually, I am not able to debug the Mysql code in Perl, because it doesn't generate any Mysql error when the script is called from a browser. If it's called from root, I get the Mysql error. If it's called from root with a chroot, I still get the error.

Called from root:

perl /httpd/domainname/cgi/testerreur.pl DBD::mysql::st execute failed: Unknown column 'clientpreno' in 'field +list' at /httpd/domainname/cgi/testerreur.pl line 22.

Called from root with a chroot:

chroot /httpd perl /httpd/domainname/cgi/testerreur.pl DBD::mysql::st execute failed: Unknown column 'clientpreno' in 'field +list' at /httpd/domainname/cgi/testerreur.pl line 22.

Called from a browser (results from the Apache logs):

No errors in the logs and the page is shown in the browser.

Just like I said in the previous post, if I make a Perl error, I get the usual "Premature end of script headers".

Thanks


Comment on Re^2: Perl and Mysql logs
Select or Download Code
Re^3: Perl and Mysql logs
by PierreForget (Initiate) on Mar 19, 2013 at 18:30 UTC

    Hi, I found something new.

    I finally found where Apache is sending the Mysql logs. It is sending it directly to the main Apache logs, instead of the local vhost logs, although the directive in httpd.conf is local:

    Errorlog "/httpd/restaurant-quebec/logs/error_log"

    Here is the log in /httpd/usr/local/apache2/logs

    DBD::mysql::st execute failed: Unknown column 'clientpreno' in 'field +list' at testerreur.pl line 22.

    So, it's not a Perl problem, but an Apache problem. I will continue my search and I will post the results once I find the issue, so that people who search for the same problem will have a solution.

    Thanks to everybody who took the time to read and reply.

      Hi everybody,

      I finally found the solution. In Apache, the newer version with "event" threading has the side-effect of logging everything in the main server log file. It seems to be that the errors are sent to stderr and stderr can only be redirected to the main server error log file.

      The workaround that was suggested to me in the mail-archives.apache.org was to recompile with the following switches (added to all the other switches I used):

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

      Making sure I was using mod_cgi instead of mod_cgid in the modules section of httpd.conf

      If you look in the Apache documents, it tells you that the error log is redirected to the vhost file if the line exist in the vhost section:

      ErrorLog "/httpd/domainname/logs/error_log"

      But that is not true if you use mod_cgid. Only true if you use mod_cgi.

      Quite funny that you have to revert to older ways to get back your logs in the right place.

      Hope this help other people with the same problem.

      Thanks again to all the people who took the time to read or respond.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024305]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2014-08-21 18:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (141 votes), past polls