Jump to content

Tracy Debugger


adrian

Recommended Posts

A pro would be, to have it into the TracyDebugger toolbox makes it independant from your own browsers and its extensions. Useful in the more rare cases, where you are using a foreign PC. So, it should be in, but disabled by default. :)

  • Like 4
Link to comment
Share on other sites

what do you think about integrating a w3 validator into the tracy bar?

Anyone else have any thoughts on this?

I don't see w3 validating necessary or adding something to tracy debugger which has it's focus on debugging, php, api, calls, etc. Besides, there is already so much available for w3 validating.

Link to comment
Share on other sites

bernhard - I am rethinking this - I think that szabesz and horst make some compelling arguments - in particular I like the idea that Tracy can make your life easier when you're not at your normal dev machine, so adding this could be useful.

Do you have a preferred solution? How did you set up what you have in that screencast?

I was looking at: https://github.com/micheh/w3c-validator but was wondering if you were just passing a URL to an iframe of the w3c validator? I actually like the idea of being able to color the panel icon in Tracy depending on the report status, so I think something like that Github library might help in that.

PS Mismatched html tags is a great example of a bug that should be dealt with, so from that perspective I think it might fit nicely with Tracy.

  • Like 4
Link to comment
Share on other sites

Do you expose Tracy to the public? The validator shouldn't see it at all.

While developing I love to have it all in front of my nose.

How about utilizing the console? Similar to fireLog()

Can do that, on the other-hand it shouldn't be that hard to replace </body></html> with Tracies markup plus </body></html> I guess. 

  • Like 1
Link to comment
Share on other sites

Hi Adrian,

When tracy is injected to the page, it breaks the W3c validator. It's not a real big deal but never-the-less: Are you willing to make Tracy compatible with the W3c validator :-).

Hi Martijn,

I agree - it's weird what the Nette/Tracy folks did by injecting the debugger bar code after the closing <html> tag. I don't really know if they have a valid reason or not. I should post an issue with them though and see what they say.

Link to comment
Share on other sites

sorry adrian for being late - there was too much going on in this thread so i set notifications to weekly...

the simplest solution would be to send a get request like this:

some errors: https://validator.nu/?doc=https://processwire.com/talk/&out=json

valid: https://validator.nu/?doc=https://processwire.com/&out=json

maybe parse this json and set the color of the panel to green = valid, orange = warnings, red = errors

and a link to the validator report. nothing more needed, i think

  • Like 1
Link to comment
Share on other sites

I've had some bugtracking time because Tracy didn't show up. All I was got is 


<!-- Tracy Debug Bar -->
<div id="tracy-debug"></div>
<link rel="stylesheet" href="?_tracy_bar=css&v=2.4-dev" id="tracy-debug-style" />
<script src="?_tracy_bar=js&v=2.4-dev" id="tracy-debug-script"></script>
<script src="?_tracy_bar=content.b633f8ba5be45d8f70234e0a83c77ebc"></script>

And EOF (html source).

First I thought it was the latest devns branch but on another site it worked even with PW 3.015.

Second I reverted PHP version to 5.6 (from 7.05), but no joy.

Finally I reverted Tracy to 0.9.8 and it's working now. I have no idea what could cause this. No error logs about this at all on the server.

I can check versions up from 0.9.8 to see where it starts failing if you provide links to it (or can I find them on GitHub?).

Link to comment
Share on other sites

@tpr - sorry to hear that - definitely weird as it's working fine here. Obviously hard for me to debug without any errors.

It would be awesome if you could figure out the exact commit that breaks it for you.

You can download the zip from Github for each commit quite easily. 

post-985-0-11558700-1461333920_thumb.png

That will take you to a link like this:

https://github.com/adrianbj/TracyDebugger/tree/0b9696921bcd33ac18460b5501f13c8784b4188b

From each of these you can use the normal "Download Zip" button.

Sorry this could be quite time consuming for you. You probably do this already, but in this situation I always grab the middle commit between the one I know is working and the one that isn't. If that works then split the difference to the latest and if it doesn't split the difference to the oldest and so on - that should reduce the effort significantly.

Thanks for taking this on!

  • Like 2
Link to comment
Share on other sites

I was just writing this when your new post came through :)

If you haven't already started the version checking, perhaps first try this latest change to the Tracy core which looks like it might possibly be the issue:

https://github.com/nette/tracy/commit/5ecd8e7b011580f44191be7ef40487e8b09a2555#diff-36dcf2914a684042e3718478c5c6faa9

You can just manually add that "isset" to the src/Tracy/assets/Bar/loader.phtml file.

Also, perhaps it might be worth trying the stable branch of Tracy - remember I recently (v1.2.6) added the master (dev) branch if you have php 5.4. Easiest way to do this is probably to edit this line: https://github.com/adrianbj/TracyDebugger/blob/f8d4ca6c1f8afe31331bdaa94a89b50874371586/TracyDebugger.module#L103 so that it loads stable anyway.

So could you please check both those approaches in that order please. Hopefully it's the first one.

Link to comment
Share on other sites

@tpr - those suggestion were kinda only relevant before I committed the update. 

@netcarver - looking forward to seeing those errors - thanks.

I can't imagine that either of you guys are running less than php 5.4, but could you confirm that https://github.com/adrianbj/TracyDebugger/blob/master/TracyDebugger.module#L102 is validating to true and therefore including the master (dev) version of Tracy? While you are there I guess it would be good to see if instead the stable version works.

Thanks again.

Link to comment
Share on other sites

Hi Adrian,

Thanks for all your work on this module - it's becoming highly useful. I have to admit, I miss it, now it's broken.

Here's what I know.

* My PHP version check is getting me the branch of Tracy.

* I'm using a fresh install of Tracy 1.3.0 on PW 2.7.3 (PHP 7) on a Linux box running a straight LAMP stack.

* Every page (front or admin) that includes Tracy hangs while Tracy loads until the script timeout limit is hit.

post-465-0-96936900-1461427489_thumb.png

* If I then turn off panel labels I can get it to load but it then looks like this;

post-465-0-28440700-1461427233_thumb.png

I'm going to downgrade to the previous version and see if I can get it going again.

Link to comment
Share on other sites

Ok, I tracked this down. Basically, the downgrade has the same issue.

I used the Tracy log call last night while debugging (concurrent with an update to 1.3.0) and that's when the problems started. I just deleted the log file and all is well again. Not sure why Tracy was having trouble reading the file, it had the correct permissions (as far as I can see.)

Hope that helps!

Edited to add: Removing the TracyLog panel from the panel list still reproduces the problem from the second screenshot in my post above.

Link to comment
Share on other sites

Ok, I tracked this down. Basically the downgrade has the same issue.

I used the Tracy log call last night while debugging (concurrent with an update to 1.3.0) and that's when the problems started. I just deleted the log file and all is well again. Not sure why Tracy was having trouble reading the file, it had the correct permissions (as far as I can see.)

Hope that helps!

Thanks for helping to debug. I wonder if this is the same issue that @tpr is having?

I can replicate what I think is the same problem if the log file doesn't have read permission. Can you please check to see if it works with 0777 (just a temp change to debug)? I am using wireMkdir to create the tracy logs folder though so I feel like it should be correct.

Also wondering if maybe there is some issue with the content of the log file - does it return with a simple text entry? If the permissions change doesn't fix things, any chance you could PM me a copy of the log file you deleted (if you still have backup of it) so I can test?

Link to comment
Share on other sites

Unfortunately, I zapped the entire Tracy log directory with a `sudo rm -rf blahblahblah` ... there's nothing left.

I did, however, look at the permissions on the file. Owner and Group were set to the HTTP server's user and group; the permissions on the file itself were `rw` for the owner, `r` for the group and `r` for others. I did not look at permissions on Tracy's log folder.

I'd like to spend more time helping debug this - but I need a working Tracy setup at the moment. When I can afford to break it, I'll happily partake :)

Edited to add: I also looked at the content of the log file and it opened up in my text editor just fine. Looked like good, clean, text output.

Link to comment
Share on other sites

Line 120 evaluates to true here. Unfortunately setting the $tracyVersion to "stable" couldn't make the bar to show up.

I have php 7.05 here, and PW 3.015.

Update:

I was messing things and perhaps the solution was the permission issue @netcarver mentioned, now the bar shows up. I never used the log function btw, only bd() or d(). Setting the assets/logs/tracy dir to 777 apparently solved the issue.

Link to comment
Share on other sites

Thanks both of you - so it really does seem to be a permissions issue.

Given @netcarver's report about the file permissions being correct, I was wondering if there was maybe an issue with the folder permissions - I was initially thinking it might be a lack of execute permission on the created "/site/assets/logs/tracy/" folder, rather than the log files themselves, but then I don't see how the file could be written in the first place unless the permissions have changed since the file was initially written.

So I am actually not getting anywhere :)

I do have a couple of tweaks coming (one which might fix the issue where @netcarver still had the problem even when the Tracy logs panel was disabled), but I don't think anything will fix this properly yet.

What do you both have your $config->chmodDir set to? If you change this (increase permissions), delete the /logs/tracy folder and send something to the log again, does it work now?

  • Like 1
Link to comment
Share on other sites

It's the default here:

$config->chmodDir = '0755'; // permission for directories created by ProcessWire
$config->chmodFile = '0644'; // permission for files created by ProcessWire

I've always had issues with permissions on this server but setting the owner to "apache" seemed to solved that, I shouldn't use 777 for certain directories (like logs). Maybe it's still not perfect?

Now I cannot reproduce the issue (not even when deleting the tracy dir), the module seem to work fine.

Btw, have you tried Tracy on https? I'm getting really slow page loads (admin & frontend), often 5-8 seconds when Tracy is on. Maybe it's not because https but I have only one site where I can check this.

(this is another server, not the same with the issue we talked above)

Link to comment
Share on other sites

Interesting that it's now working fine - it does suggest that there was initially an access permission problem - either "execute" on the tracy folder or "read" on the file. Any chance that might have happened when copying a site from one server to another? I wonder if I should add a check on the folder and chmod it to the default directory value for PW if it doesn't already match?

I haven't tested on https yet - can you narrow it down to one particular panel, or does it cause the slowdown even if all custom panels are disabled?

Link to comment
Share on other sites

  • adrian pinned and locked this topic
  • adrian unpinned and pinned this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...