Hi there

I read in Config/core.php:

/**
 * Configure the Error handler used to handle errors for your application.  
By default
 * ErrorHandler::handleError() is used.  It will display errors using 
Debugger, when debug > 0
 * and log errors with CakeLog when debug = 0.

In both 2.0 and 2.1 I've done the following.  Created a very simple 
database schema (1 table called users with an id field and a name field) 
and then done:

cake bake project myapp
(fix up Config/database.php)
cake bake all User

I then have a working CRUD application.

Then in one of the controller actions in Controller/UsersController.php I 
introduce a spurious function call:

    public function view($id = null) {
        $this->User->id = $id;
        if (!$this->User->exists()) {
            throw new NotFoundException(__('Invalid user'));
        }
        nosuchfunc();
        $this->set('user', $this->User->read(null, $id));
    }

Now when I attempt to view a record of course I get a page back:

Fatal error: Call to undefined function nosuchfunc() in 
/var/www/myapp/Controller/UsersController.php on line *32

*followed by a nicely formatted stack trace.  But nothing gets logged in 
tmp/logs/error.log.

Now I change the debug level from the default 2 to level 0.  When I try the 
view action, as expected I no longer get the error page returned to the 
browser, I just get a blank page.  However, I still get nothing logged to 
error.log (or to anywhere else that I can find).

This behaviour is not as described in the comment in core.php which I quote 
above, nor is it expected!  Note that error.log _is_ writeable as is easily 
demonstrated by raising a NotFoundException by trying to view a 
non-existent user, e.g:

http://localhost/myapp/users/view/999

This *will* produce an entry in error.log when debug is set to the default 
level 2, or when set to level 0.

Can someone help me to fix it so that errors DO get logged, preferably at 
ALL times but certainly when debug is 0!

Thanks
John Sutton

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to