Short version:

How do I enable logging errors and warnings to the error_log file
without showing them to the user in the html response when CakePHP is
running in production mode?


Long version:

I've noticed that CakePHP in production mode doesn't log php errors or
warnings. Not showing them to the user through the html response is
required for production of course, but why not log them to the
error_log file?

I've searched about this and saw some people saying that code
shouldn't have any PHP errors left when it's going to production ..
but how can you be 100% sure? (Unless you are absolutely sure that you
have 100% test coverage.)

There was also a ticket for it: https://trac.cakephp.org/ticket/3270
which says it won't be fixed because you can invoke the debugger at
any point. I'm not sure whether that just means calling
Configure::write('debug', 2); or there is more to it, as calling
Configure::write('debug', (1 or2) ) is something you'd never want to
do in production (unless maybe for authorized users) since users would
see all the debug messages.

I think it is a lot better to log all warnings and errors but don't
show them to the user. Let the errors/warnings be logged .. it is
what's logging is for .. logging problems when they occur so you can
check back to see if there are any problems later. Then when you get a
user reporting something not working right you can check the php log
to see if something went wrong in php. Maybe it is happening in a
special case that you can't reproduce easily, but a quick look at the
php log might pinpoint the problem.

Warnings for dynamic stuff like maybe invalid array indexes could be
useful when tracking down bugs. Also, I'm not sure how Cake handles it
but 3rd party code included through vendors might have bugs which php
error/warning logs would help locate.

So is there a way to do what I'm asking for here without changing cake
core?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to