Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
logging response object information
  • Hi, I am looking for a way to log (using the fuel core Log class, via Log::debug(...) for example ) the content of a response returned by a controller.
    I'd like to log at least the body if it's text, and the http headers.
    Is there a relatively simple way to do this? thanks. Laurent
  • Is this about your application performing a REST request, or about a browser sending a request to your application?
  • For both use cases, but more useful for requests not coming from a desktop/laptop browser (e.g. REST request, or request from a mobile app WebView). When it's a desktop/laptop browser sending the request, I can usually see the response using browser plugings like firebug.
  • I would define a 'request_finished' event callback, and in that callback get the response using \Request::active()->response(); You would need v1.3, as this is new functionality.
  • unfortunately, i am using the latest release 1.2.1. no plans to use 1.3.
    any other ideas? Last night I figured out how to modify the fuel core Response class to meet my immediate need, but that's not code i would check-in in my code repository.
    Also ideally I would like that logging to be done per controller or action, not system wide and doesn't involve modifying fuel core if possible.
  • 1.3 is going to be released in a few weeks, upgrading from 1.2.x is peanuts, there is only one API change, related to the URI class. If not an option, extend the core class and overload the required methods. Do not modify core code, that will become a nightmare when you do decide to upgrade.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion