If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Admin Tools / Show Debug Files Automatically

Show Debug Files Automatically

Started by torvista on 18 Jun 2011, 5:35 PM · Views: 4,484

Results 1 to 20 of 24
18 Jun 2011, 5:35 PM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #1 by torvista

Someone (hello Nigel) just mentioned they would like

For a widget, I would specifically like one that tells me

  1. How many debugfiles are in /cache
  2. Displays the contents of the latest debug file

Occasionally while fiddling about with all this code I don't quite understand, I don't cause a white screen of death immediately, but later I find that there are debug files in the cache.

I'd prefer to know this at the time so this is a bit of code I did to flag up in the admin when there are debug.log files generated in the cache.

I put it at the top of admin/includes/header.php to use the standard error reporting function

so find

// display alerts/error messages, if any
if ($messageStack->size > 0) {
echo $messageStack->output();
}

and put this code before it

// check for debug logs
$path = str_replace(DIR_FS_CATALOG, '../', DIR_FS_SQL_CACHE).'/';
if (count(glob($path . '.')) > 1) {//only htaccess and index.php are in directory normally
$directory = opendir($path);
while($item = readdir($directory)){
if (strpos($item, '.log',1)){
$messageStack->add('Debug log file exists: '.DIR_FS_SQL_CACHE.'/'.$item);
}
}
}

Test it by creating a whatever.log text file in the cache directory.
The admin should display the error bar at the top of the admin pages with this info.

Improvements to this code are most welcome, if not essential (I wouldn't know).

regards
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

18 Jun 2011, 9:05 PM
#2
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Post #2 by nigelt74

Cheers Steve, I have been looking at writing something similar, but that suits my needs perfectly

Webzings Design
Semi retired from Web Design

23 Dec 2012, 10:09 AM
#3
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Post #3 by picandnix

Have tried but can't seem to get this to work with 1.5.1
Any hints or solutions welcome please.

23 Dec 2012, 1:35 PM
#5
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Post #5 by picandnix

gjh42:

Debug log files now go in the /logs/ folder instead of the /cache/ folder.

Thank you Glenn but where would I edit the above to point to the correct path, logs rather than cache?

26 Dec 2012, 8:20 AM
#6
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Post #6 by torvista

Have tried but can't seem to get this to work with 1.5.1

This is what I have, using 1.51.```php
// steve check for and display debug logs
$path = str_replace(DIR_FS_CATALOG,'../',DIR_FS_LOGS).'/';
$matches = glob($path ."myDEBUG*.*");
if (is_array($matches)) {
foreach ($matches as $filename) {
$messageStack->add('Debug log file exists: '.str_replace($path,DIR_FS_LOGS.'/',$filename),'warning');
}
}

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

26 Dec 2012, 9:59 AM
#7
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Post #7 by picandnix

torvista:

This is what I have, using 1.51.```php
// steve check for and display debug logs
$path = str_replace(DIR_FS_CATALOG,'../',DIR_FS_LOGS).'/';
$matches = glob($path ."myDEBUG*.*");
if (is_array($matches)) {
foreach ($matches as $filename) {
$messageStack->add('Debug log file exists: '.str_replace($path,DIR_FS_LOGS.'/',$filename),'warning');
}
}


Thank you I really appreciate that, I'll give that a go later.
26 Dec 2012, 4:06 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #8 by lat9

Nice one, Steve! Thanks for sharing.

26 Dec 2012, 6:23 PM
#9
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,779
Plugin Contributions:
2

Post #9 by picandnix

Yes thankyou again, works a treat and I think it compliments Lat9's handy mod too, thank you both.

1 Jan 2013, 7:10 PM
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,144
Plugin Contributions:
56

Post #10 by lat9

I just noticed, looking through the Zen Cart github repository, that this feature is slated for inclusion in the Zen Cart v1.6.0 admin! :clap:

1 Jan 2013, 11:30 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #11 by ajeh

I thought it rather handy to know this info on files in the /cache and /logs ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

26 Sep 2013, 8:27 AM
#12
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Post #12 by enzo_ita

Hi,
I was looking exactly for this feature since I am one of those that venture in modding files and then have the logs directory filling up....
I have added the code to header.php and the defne for the logs dir in the configures.php files, but no way to see the message coming up in the admin.
Can someone tell me what to look for?
Thanks
enzo

26 Sep 2013, 12:55 PM
#13
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Post #13 by gilby

enzo-ita:

Hi,
I was looking exactly for this feature since I am one of those that venture in modding files and then have the logs directory filling up....
I have added the code to header.php and the defne for the logs dir in the configures.php files, but no way to see the message coming up in the admin.
Can someone tell me what to look for?
Thanks
enzoTake a look at this mod: Display Log Files
and its support thread: Display Log Files [Support Thread]

26 Sep 2013, 10:44 PM
#14
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Post #14 by enzo_ita

Thanks for yor answer but what is this post should display AUTOMATICALLY THE LOG files. I have installed the plugin you suggested but, obviously, it does not what I am looking for since it is not created for that.
I want to access the admin page and be warned about log files existing if they are.
enzo

26 Sep 2013, 11:24 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #15 by drbyte

enzo-ita:

Thanks for yor answer but what is this post should display AUTOMATICALLY THE LOG files. I have installed the plugin you suggested but, obviously, it does not what I am looking for since it is not created for that.
I want to access the admin page and be warned about log files existing if they are.
enzo

That's what the above mentioned code by torvista does.
And similar feature is also built-in to v1.6.0 ... although sometimes I wish it wasn't.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

27 Sep 2013, 1:13 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #16 by ajeh

Hey I resemble that remark on that new similar feature being built into v16 ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

27 Sep 2013, 10:06 AM
#17
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Post #17 by swguy

DrByte:

That's what the above mentioned code by torvista does.
And similar feature is also built-in to v1.6.0 ... although sometimes I wish it wasn't.

LOL I was thinking about submitting a PR to just show the count and not the names of the files. :)

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

27 Sep 2013, 12:33 PM
#18
enzo_ita avatar

enzo_ita

Zen Follower

Join Date:
Jul 2009
Posts:
402
Plugin Contributions:
0

Post #18 by enzo_ita

DrByte:

That's what the above mentioned code by torvista does.
And similar feature is also built-in to v1.6.0 ... although sometimes I wish it wasn't.
Yeah and i did add the code to header.php but without results.
I think soemthing is wrong, but what?
About 1.60 I must wait for the italian version, and considering it is still not out.....
Thanks for any suggestion.
enzo

19 Aug 2014, 4:41 AM
#19
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,908
Plugin Contributions:
23

Post #19 by dbltoe

Any thoughts on adding the paypal log files to this call out?

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

19 Aug 2014, 11:00 AM
#20
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #20 by mc12345678

dbltoe:

Any thoughts on adding the paypal log files to this call out?

If added, would it still just be a report of all logs, or would there be some sort of separation: error logs and then say payment logs/paypal logs?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...