Question

I have a bunch of PHP warnings in my CakePHP error log. Problem is, I can't figure out what scenarios are causing them, and in CakePHP 2.2.3 at least the URL/referrer is not included in the error log information.

I got this suggestion from another SO question, and added the following code to my AppController's beforeFilter section:

    if ($this->name === 'CakeError') 
    { 
        $this->log("URL: ".$this->here); 
        $this->log("Referrer: ".$this->referer());
    }

However, this only seems to work if an error has been thrown - it doesn't work if a PHP warning has occurred. How would I adjust this code to catch PHP warnings?

Or is there another way to include the full URL & referrer in the error log?

Was it helpful?

Solution

Resolved using mark's custom ErrorHandler from the tools plugin: https://github.com/dereuromark/tools/blob/master/Lib/Error/MyErrorHandler.php#L131

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top