Monday, March 2, 2009

Re: Error handling in production

I know this may seem like a strange idea, but why not iron out those
notices before going live?

On Mar 2, 7:52 am, Aidan Lister <aidanlis...@gmail.com> wrote:
> I have two questions for error handling in a production environment.
>
> a) How can I log warnings & notices
> b) What's the best way to display custom error pages
>
> This is what I know so far,
>
> I can define app_error.php and create my custom error handlers there.
> This works fine for development, but once I switch to production these
> errors are replaced by error500.
>
> I can define an appError in app_controller.php, but this doesn't catch
> notices, and I see no obvious mechanism for calling my custom error
> handlers in app_error.php.
>
> I can overwrite __construct in app_error.php to do something like:
>
> <?php
>     function __construct($method, $messages)
>     {
>         $methods = array('paypal', 'system', 'payflow', 'cart',
> 'generate');
>         if (in_array($method, $methods)) {
>             Configure::write('debug', 1);
>         }
>         parent::__construct($method, $messages);
>     }
> ?>
>
> But I've been told this is an exceptionally bad idea by the gurus in
> #cakephp.
>
> So, I ask, what does everyone else do?
>
> Thanks,
> Aidan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: