Jump to content

Tracy Debugger


adrian

Recommended Posts

3 hours ago, netcarver said:

I'd like to report that I had a recent differential backup that was growing rather fast, and it turned out to be tracy files in the session directory of the site.

Hi Steve,

Are you talking about PHP's session folder, or PW's /site/assets/sessions/ ?

For the former, should PHP's garbage collection take care of that?

For the latter, I see I have a few (5) old "tracy.0e3b49e668" files from Apr and May 2016, but none more recent. I wonder if this is an old issue that has been fixed. It sounds like you are still seeing new additions though?

Could you provide more details on the age of these files, and also your OS, PHP version, etc?

Thanks!

Link to comment
Share on other sites

Hi Adrian,

Sorry, I meant site/assets/sessions/ and the tracy* files within that. At one point there were thousands of megabyte-size files in there. The site this happened on is running Tracy 3.5.5 on PW 3.0.42.

OS: Arch linux. PHP: 7.1

Irony of moment: I disabled Tracy, then I deleted the tracy* files AND recreated the backup set, deleting the differentials. I've been back into the admin area and tried re-enabling Tracy, but I'm not seeing the files being created now - suggesting it might have been from an older version of the module (this is a site I use to experiment with new PW stuff, so it has seen multiple revisions of Tracy installed over the months.) If the issue recurs I shall, of course, let you know more.

Regards,
Steve

Link to comment
Share on other sites

Tracy went to language school!

Now she shows page titles and names in the current language, along with the title and name of that language in the Summary section.

And she has a completely new Language Info section showing a summary of the title, name and active status of each language. Hopefully this should help to debug why something is not showing on the front-end.

58b74d1263ef3_ScreenShot2017-03-01at2_36_11PM.thumb.png.309f0a72622505563e378122fd096e17.png

The ⓘ icon highlights titles/names that are missing in the current language. It shows the default title/name instead, along with this icon.

Let me know if you notice any problems!

 

  • Like 5
Link to comment
Share on other sites

Hi there, thanks for the great module.

I installed it on PW 3.0.33 with PHP 5.4.45 and I get an error message:

Fatal error: Call to undefined method stdClass::getIterator() in /home/funevents/public_html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/DebugModePanel.php on line 422

Is there something missing on my server? Thanks.

Link to comment
Share on other sites

Good day!

This module is in such a rapid development bringing tons of new awesomeness I just can't keep the pace even reading this thread :rolleyes:. After upgrade (from a rather old version) the frontend panel stopped working for non-superusers. I figured out I need to create tracy-debugger permission and assign it to every role I want to test the site with. And probably remove the assignment on a live site (maybe only if it is in DEVELOPMENT mode).

I often debug under different roles. Is the way described above the right one for it? Or there are some shortcuts? Maybe I am missing something obvious?

Link to comment
Share on other sites

@Jozsef - I'll look into that shortly.

@Ivan Gretsky - Yeah, I did change behaviour slightly there. Previously the debug bar would display in DETECT mode on a local dev environment even without the "tracy-debugger" permission. Even though as far as I know it isn't possible to spoof $_SERVER['REMOTE_ADDR'], I thought it still might be a little confusing/concerning to users. I would be happy to bring this back as an option though. I'd add a new config setting checkbox that says - "Force development mode for guests when DETECT determines localhost", or something like that. Would that be helpful for your workflow?

On the issue of debugging under different roles, don't forget about the User Switcher panel which allows you to switch to any user (including logged out as guest) and still have the debug bar enabled.

 

  • Like 2
Link to comment
Share on other sites

@Jozsef - that error should be fixed in the latest version - please let me know if you have any more problems with it.

@Ivan Gretsky - latest version adds that new setting - let me know if it works as expected. I also added to/revised the explanatory text for the various access settings in the hopes of makes it easier to understand.

Cheers,
Adrian

  • Like 3
Link to comment
Share on other sites

6 hours ago, Ivan Gretsky said:

I just can't keep the pace even reading this thread

I wish there was a supported way to display a simple CHANGELOG that comes with a module. Other CMSes utilize this dead simple but very useful feature. I wonder why we have to live without it. Once I pointed this out, but only four of us seem to care including @adrian, of course :) Why are people are so uninterested in this? Strange.

Last time I spent at least 5 minutes to find the "Admin Style" option of Tracy because it was renamed to "Server Type Indicator". A simple message like "Admin Style was renamed to Server Type Indicator" would have saved me the hassle. There are so many settings of Tracy that I often get lost, especially when things are renamed or moved around.

  • Like 3
Link to comment
Share on other sites

@szabesz - firstly, sorry for renaming that setting on you :)

I just posted a response in that Wishlist thread - I agree that we need this badly - I have added some suggestions for how, and also to include a "Breaking changes" flag in the ProcessWire Upgrades module, which I also think is important.

  • Like 3
Link to comment
Share on other sites

Hi @adrian,

Is there a way to tell the debug bar not to appear on pages with a particular template? The situation is that I'd like to be able to turn off the debug bar for the Form Builder template that is used when the form is rendered inside an iframe. I know there is an option to disable the debug bar in modals, but not for iframes I think? And it's often useful to have the debug bar in iframes so it would be great to be able to target templates rather than all iframes.

Any thoughts on this?

Link to comment
Share on other sites

15 minutes ago, adrian said:

I just committed a new version with the template restriction options.

Thanks for implementing this so quickly.

The template restriction works if I select a template such as "home" or "basic-page", but it doesn't work for the "form-builder" template for some reason. The debug bar still appears on the Form Builder page when it is loaded in an iframe and when the page is loaded directly.

I'm also seeing an error in the Captain Hook panel which may or may not be related:

ErrorException: Undefined offset: 2 in D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\CaptainHookPanel.php:111
Stack trace:
#0 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\CaptainHookPanel.php(111): Tracy\Bar->Tracy\{closure}(8, 'Undefined offse...', 'D:\\Websites\\__w...', 111, Array)
#1 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-master\src\Tracy\Bar.php(153): CaptainHookPanel->getPanel()
#2 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-master\src\Tracy\Bar.php(108): Tracy\Bar->renderPanels()
#3 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-master\src\Tracy\Debugger.php(266): Tracy\Bar->render()
#4 [internal function]: Tracy\Debugger::shutdownHandler()
#5 {main}

 

Link to comment
Share on other sites

Hi @Robin S - sorry it's not working for the form-builder template. I don't use ForBuilder so a little hard to debug, but I'll take a look and see what I can figure out.

Regarding the Captain Hook error - no, not related - I added some code recently to split the files into sections - that is what is causing the error for you, but still not sure why you are getting that. Any chance you could debug what the contents of $segments is when the undefined offset is reported?

Thanks,
Adrian

Link to comment
Share on other sites

14 minutes ago, adrian said:

Any chance you could debug what the contents of $segments is when the undefined offset is reported?

I think the error is down to the Windows directory separator thing that reared its head a while ago. If I json_encode and log $segments I see results like this:

2017-03-09_211833.png.beb2c5399d6566cc412e726c1f4e9186.png

Not sure why there would be double slashes there instead of single slashes.

If I change line 110 to be...

$segments = explode(DIRECTORY_SEPARATOR, $path);

...then the panel error is fixed, although I notice that the 'wire' segment still looks a bit funky:

2017-03-09_211939.png.ff53a67576789b78014e7013808d5b00.png

Maybe there are other places where a hardcoded forward slash should be replaced with the DIRECTORY_SEPARATOR constant?

 

24 minutes ago, adrian said:

I don't use ForBuilder so a little hard to debug

I don't mean to get OT here, but I'm curious how you like to handle front-end forms if you don't use Form Builder. Do you use the forms API, or a third-party forms library like Nette Forms, or some other approach?

Link to comment
Share on other sites

Thanks @Robin S - I am bad at remembering that :)

New version should fix everything and should also take care of that extra "\/" that you saw at the start. Can you please confirm that your CaptainHook panel output now looks like this - note the "Site Modules" (along with "Wire Core" and "Wire Modules" section headers) and the way the files now start with just their main folder, eg:

AdminCustomFiles/AdminCustomFiles.module compared with the old: /site/modules/AdminCustomFiles/AdminCustomFiles.module

I think this new way makes it much easier to scroll down to find what you are looking for.

58c1692c6d696_ScreenShot2017-03-09at6_39_18AM.png.1d39e9f76441127cb8416a24d2af74ae.png

 

Regarding FormBuilder - yes, I use the forms API.

I'll see what I can do about figuring out what the issue might be with the template detection shortly. I have a hunch that it's related to the way I am getting the template of the page - because I am in ini() and not ready() when I need to do this, it's a bit of a hack :)

  • Like 2
Link to comment
Share on other sites

8 hours ago, adrian said:

Please let me know how it goes.

Captain Hook panel is working and removing the debug bar on the Form Builder template is also working. Thanks!

However, there is a new panel error:

ErrorException: A non well formed numeric value encountered in D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\panels\ProcesswireInfoPanel.php:359
Stack trace:
#0 [internal function]: Tracy\Bar->Tracy\{closure}(8, 'A non well form...', 'D:\\Websites\\__w...', 359, Array)
#1 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\panels\ProcesswireInfoPanel.php(359): date('Y-m-d H:i:s', '2017-03-02 21:3...')
#2 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\tracy-master\src\Tracy\Bar.php(153): ProcesswireInfoPanel->getPanel()
#3 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\tracy-master\src\Tracy\Bar.php(108): Tracy\Bar->renderPanels()
#4 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\tracy-master\src\Tracy\Debugger.php(266): Tracy\Bar->render()
#5 [internal function]: Tracy\Debugger::shutdownHandler()
#6 {main}

If I log $val before line 359 I get this:

$val: {"pages_id":"1054","data":"dreamstimefree_5848146.jpg","sort":"2","description":"","modified":"2017-03-02 21:39:29","created":"2017-03-02 21:39:29"}

 

Link to comment
Share on other sites

Hi @Robin S - thanks for confirming the Captain Hook and form builder template fixes.

That issue on the PW Info panel is very weird. The created field for that image is already a string rather than a timestamp, but I haven't ever seen that. I know how to fix, but it would be helpful to know why it is like that in the first place - do you have any special settings on that image field? Is the error on all your pages with images?

PS Just did a little testing and it looks like it is likely only with images in repeaters that we even get to this line in the code, but even so, I am still getting a timestamp returned. I would expect it has something to do with outputformatting being on, but I still can't seem to replicate - at thoughts at your end?

  • Like 1
Link to comment
Share on other sites

32 minutes ago, adrian said:

That issue on the PW Info panel is very weird.

It is weird and not worth spending time on I think. I thought it was some general error but it actually only happens on one page and relates to something I was testing with FieldtypeSelectExtOption and hooks.

The field and hooks apply to several pages containing similar data yet I only got the panel error on one - I tried a few things to narrow it down but couldn't see the cause. Then I removed and readded the Select External Option field to the template and all is well now. So just one of those strange things that spontaneously resolves.

  • Like 1
Link to comment
Share on other sites

Thanks @Robin S for looking into that - glad it sorted itself out. I am tempted to run a strtotime() on the "created" date before passing it to date() to prevent this from possibly happening, but might wait to see if it appears again before worrying about it.

Cheers,
Adrian

Link to comment
Share on other sites

Hi @adrian, I was just wondering what location gets scanned for ToDo Items in Tracy?  I'm assuming it is your site's templates directory?

I wonder if you should add node_modules, bower_components, .sass-cache by default?  Seems like if it had to scan all those files it would slow things down a lot?

Maybe you can provide an option to turn that feature off completely?

  • Like 1
Link to comment
Share on other sites

@gmclelland - yes, by default it is just the files inside /site/templates/ and all it's subfolders, but it can also include /site/modules/ if you've checked that option.

Yes, it is a very good idea to add sass, bower, etc files to the Ignore Directories.

6 minutes ago, gmclelland said:

Maybe you can provide an option to turn that feature off completely?

What feature exactly do you want to turn off?

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...