Tuesday, April 29, 2014

Trace request URL on error

Is it possible to trace the requested url in all errors on error.log?

I have a website and occasionally see the error.log. Sometimes I get :


2014-04-23 14:50:07 Error: [MissingControllerException] Controller class Apple-touch-icon-precomposed.png
Controller could not be found.
Exception Attributes: array (
  'class' => 'Apple-touch-icon-precomposed.pngController',
  'plugin' => NULL,
)
Request URL: /apple-touch-icon-precomposed.png
Stack Trace:
.....

where it is clear what the user has asked in the url.

But I have other errors like:

2014-04-23 13:40:04 Warning: Warning (2): Invalid argument supplied for foreach() in [/var/www/vhosts/xxxxxx/httpdocs/app/View/Actions/view.ctp, line 7]
Trace:
include - APP/View/Actions/view.ctp, line 7
View::_evaluate() - CORE/Cake/View/View.php, line 935
View::_render() - CORE/Cake/View/View.php, line 897
View::render() - CORE/Cake/View/View.php, line 466
Controller::render() - CORE/Cake/Controller/Controller.php, line 954
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 192
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 160
[main] - APP/webroot/index.php, line 92


Request URL isn't shown here, so I cannot figure out how the error was produced (or at least start investigating). Is there a way to embed such information in error log?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: