Go Back   Forum Care Forums > Development Reference Area > Php Development

Reply
 
LinkBack Thread Tools Display Modes
Error logging
Old
  (#1)
Clark Alexander
Guest
 
Posts: n/a
Default Error logging - 06-02-2007, 08:56 PM

We have the following php.ini settings:
error_reporting = E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off

on a SuSE 10.1 server and the errors are being logged to
/var/log/apache2/error_log
(although I can't seem to find a setting that is making that happen.)

parse errors ARE being logged to this file and that would be extremely
useful information for students to be able to have when trying to find
problems in their scripts. I can't just make that file readable to them.

So, I had students create a "logs" directory within their file area and set
the permissions so that the server can to it. I have them adding the
following to the script(s) that they wish to troubleshoot:

ini_set("log_errors", "On");
ini_set("error_reporting", E_ALL);
ini_set("error_log", "logs/error_log");


Parse errors are not being written to their personal log file, though. Why
not?? About the only going in there are NOTICE level entries.

Thanks.

Clark W. Alexander
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: [PHP] Error logging
Old
  (#2)
Jochem Maas
Guest
 
Posts: n/a
Default Re: [PHP] Error logging - 06-02-2007, 08:56 PM

Clark Alexander wrote:
> We have the following php.ini settings:
> error_reporting = E_ALL
> display_errors = Off
> display_startup_errors = Off
> log_errors = On
> log_errors_max_len = 1024
> ignore_repeated_errors = Off
> ignore_repeated_source = Off
> report_memleaks = On
> track_errors = Off
>
> on a SuSE 10.1 server and the errors are being logged to
> /var/log/apache2/error_log
> (although I can't seem to find a setting that is making that happen.)
>
> parse errors ARE being logged to this file and that would be extremely
> useful information for students to be able to have when trying to find
> problems in their scripts. I can't just make that file readable to them.
>
> So, I had students create a "logs" directory within their file area and set
> the permissions so that the server can to it. I have them adding the
> following to the script(s) that they wish to troubleshoot:
>
> ini_set("log_errors", "On");
> ini_set("error_reporting", E_ALL);
> ini_set("error_log", "logs/error_log");
>
>
> Parse errors are not being written to their personal log file, though. Why
> not?? About the only going in there are NOTICE level entries.


does log/error_log exist?
does the webserver have write permissions on that file?

>
> Thanks.
>
> Clark W. Alexander
>

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] Error logging
Old
  (#3)
Clark Alexander
Guest
 
Posts: n/a
Default Re: [PHP] Error logging - 06-02-2007, 08:56 PM

Yes, it does write to the file, but the only things going in there are
notice type entries.
Also, for further information, it is php 5.1.2 using the Suse rpm.


On 5/31/07 5:14 PM, in article EMAIL REMOVED, "Jochem Maas"
<EMAIL REMOVED> wrote:

> Clark Alexander wrote:
>> We have the following php.ini settings:
>> error_reporting = E_ALL
>> display_errors = Off
>> display_startup_errors = Off
>> log_errors = On
>> log_errors_max_len = 1024
>> ignore_repeated_errors = Off
>> ignore_repeated_source = Off
>> report_memleaks = On
>> track_errors = Off
>>
>> on a SuSE 10.1 server and the errors are being logged to
>> /var/log/apache2/error_log
>> (although I can't seem to find a setting that is making that happen.)
>>
>> parse errors ARE being logged to this file and that would be extremely
>> useful information for students to be able to have when trying to find
>> problems in their scripts. I can't just make that file readable to them.
>>
>> So, I had students create a "logs" directory within their file area and set
>> the permissions so that the server can to it. I have them adding the
>> following to the script(s) that they wish to troubleshoot:
>>
>> ini_set("log_errors", "On");
>> ini_set("error_reporting", E_ALL);
>> ini_set("error_log", "logs/error_log");
>>
>>
>> Parse errors are not being written to their personal log file, though. Why
>> not?? About the only going in there are NOTICE level entries.

>
> does log/error_log exist?
> does the webserver have write permissions on that file?
>
>>
>> Thanks.
>>
>> Clark W. Alexander
>>

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] Error logging
Old
  (#4)
Clark Alexander
Guest
 
Posts: n/a
Default Re: [PHP] Error logging - 06-02-2007, 08:56 PM

Upon review, I also discover that fatal error entries are being made as
well.


On 5/31/07 5:14 PM, in article EMAIL REMOVED, "Jochem Maas"
<EMAIL REMOVED> wrote:

> Clark Alexander wrote:
>> We have the following php.ini settings:
>> error_reporting = E_ALL
>> display_errors = Off
>> display_startup_errors = Off
>> log_errors = On
>> log_errors_max_len = 1024
>> ignore_repeated_errors = Off
>> ignore_repeated_source = Off
>> report_memleaks = On
>> track_errors = Off
>>
>> on a SuSE 10.1 server and the errors are being logged to
>> /var/log/apache2/error_log
>> (although I can't seem to find a setting that is making that happen.)
>>
>> parse errors ARE being logged to this file and that would be extremely
>> useful information for students to be able to have when trying to find
>> problems in their scripts. I can't just make that file readable to them.
>>
>> So, I had students create a "logs" directory within their file area and set
>> the permissions so that the server can to it. I have them adding the
>> following to the script(s) that they wish to troubleshoot:
>>
>> ini_set("log_errors", "On");
>> ini_set("error_reporting", E_ALL);
>> ini_set("error_log", "logs/error_log");
>>
>>
>> Parse errors are not being written to their personal log file, though. Why
>> not?? About the only going in there are NOTICE level entries.

>
> does log/error_log exist?
> does the webserver have write permissions on that file?
>
>>
>> Thanks.
>>
>> Clark W. Alexander
>>

   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] Error logging
Old
  (#5)
Richard Lynch
Guest
 
Posts: n/a
Default Re: [PHP] Error logging - 06-02-2007, 08:56 PM

On Thu, May 31, 2007 3:25 pm, Clark Alexander wrote:
> We have the following php.ini settings:
> error_reporting = E_ALL
> display_errors = Off
> display_startup_errors = Off
> log_errors = On
> log_errors_max_len = 1024
> ignore_repeated_errors = Off
> ignore_repeated_source = Off
> report_memleaks = On
> track_errors = Off
>
> on a SuSE 10.1 server and the errors are being logged to
> /var/log/apache2/error_log
> (although I can't seem to find a setting that is making that happen.)
>
> parse errors ARE being logged to this file and that would be extremely
> useful information for students to be able to have when trying to find
> problems in their scripts. I can't just make that file readable to
> them.
>
> So, I had students create a "logs" directory within their file area
> and set
> the permissions so that the server can to it. I have them adding the
> following to the script(s) that they wish to troubleshoot:
>
> ini_set("log_errors", "On");
> ini_set("error_reporting", E_ALL);
> ini_set("error_log", "logs/error_log");
>
>
> Parse errors are not being written to their personal log file, though.
> Why
> not?? About the only going in there are NOTICE level entries.


Step 1:
PHP reads and parses script. Errors are logged to the current php.ini
settings, the default Apache log.

Step 2:
PHP begins processing script. log is changed to student's individual
log.

Step 3:
Any script errors AFTER 2 end up in student logs.

As you can see, any parse errors will end up in Apache logs, because
the student's code has not begun to run.

PHP halts on a parse error, so it never even executes the ini_set
calls in that case.

If there are no parse errors, and if the ini_set happens at the TOP of
the script, then the remaining errors are logged to where ini_set has
changed the values.

If you have .htaccess turned on in httpd.conf, and if you can teach
the students to edit .htaccess correctly, they could use:
php_value error_log /full/path/to/student/directory/logs/error_log

Because this will be applied by Apache *before* it begins executing
the script (almost for sure) it should, I think, come much closer to
what you want to achieve.

There may still be some kind of PHP total failure error that could
occur before Apache runs through the .htaccess file, but I can't begin
to imagine what that would be, short of a PHP segfault of some kind,
with nasty grunge left over from a previous execution causing the real
problem...

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




Contact Us - Forum Care Forums - Archive - Top