0
votes

I have a CakePHP 2 app with DebugKit installed. It is working fine and I get the memory usage and processing time in the "Timing" toolbar for each page I load.

What I also want to be able to do is get memory usage and processing times for ajax requests after the page has loaded. I am aware that I can access previous ajax requests using the "History" button in the DebugKit Toolbar, but this is doesn't really help when I want to click around the page, firing ajax requests and get instant debugging information for them.

So, I did some searching and I found that I could use Firebug + FirePHP in Firefox along with the FirePHP and FireCake libraries in my app and get all of DebugKit's stats on a per-ajax-request basis. This sounds perfect and exactly what I want to do.

Unfortunately, I can't seem to get it to work. I could only find one tutorial on the matter at http://someguyjeremy.com/blog/using-firephp-to-debug-your-cakephp-app

I have done everything that tutorial mentions and Cake gives me no errors at all. However, unless I am missing something, I don't see where in Firebug the debug info is being displayed, if indeed it is even being fed to Firebug in the first place.

My config:

Cake Version: 2.2.4

Firefox Version: 17.0.1

Firebug Version: tried with 1.11.1 and 1.9.0

FirePHP Version: 0.7.1

DebugKit Version: 2.2.0 (latest master branch)

UPDATE

It appears to work perfectly for Ajax requests that do not end in .json and, therefore, are not being picked up by the Router::parseExtensions('json'); I have in routes.php.

I took out Router::parseExtensions('json'); and changed my Ajax request to go for my filter action directly instead of calling it filter.json and Cake serves all of the FireBug headers. Unfortunately, I can't use it like this because JQuery needs the content type to be application.json.

1
Do you see Firephp headers in the firebug responses? At the very least with Firebug you can inspect the headers. Look for lots of X-Wf-X-X-X-XX headers. - jeremyharris
Also make sure the Net tab is enabled. - jeremyharris
@jeremyharris I don't know what the problem was yesterday. When I clicked on your site it was redirecting to a strange url (with the numbers 404 in the actual domain name if I remember correctly) which was subsequently timing out. Anyway, it's working ok now so I have updated the post with the correct URL. - Joseph
@jeremyharris I have updated the post with new details. I discovered that this problem is only happening when I am requesting an ajax action that is being routed through outer::parseExtensions('json'); -- I think that this is the same bug as reported at cakephp.lighthouseapp.com/projects/42880/tickets/… but I'm not exactly sure. What do you think? - Joseph

1 Answers

1
votes

It looks like this might be a documented bug:

http://cakephp.lighthouseapp.com/projects/42880/tickets/107-firephp-messages-are-not-sent-in-response-if-using-jsonxmlview-with-serialization

My usage case is not exactly the same, but outputting json is stopping the FirePHP headers from appearing. If I turn off the parse extensions directive for json, the FirePHP headers appear as they should.