문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top