Page 1 of 3 123 LastLast
Results 1 to 10 of 24
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,770
    Plugin Contributions
    30

    Default Show Debug Files Automatically

    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

  2. #2
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Show Debug Files Automatically

    Cheers Steve, I have been looking at writing something similar, but that suits my needs perfectly
    Webzings Design
    Semi retired from Web Design

  3. #3
    Join Date
    Dec 2010
    Location
    UK
    Posts
    1,771
    Plugin Contributions
    3

    Default Re: Show Debug Files Automatically

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

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Show Debug Files Automatically

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

  5. #5
    Join Date
    Dec 2010
    Location
    UK
    Posts
    1,771
    Plugin Contributions
    3

    Default Re: Show Debug Files Automatically

    Quote Originally Posted by gjh42 View Post
    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?

  6. #6
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,770
    Plugin Contributions
    30

    Default Re: Show Debug Files Automatically

    Have tried but can't seem to get this to work with 1.5.1
    This is what I have, using 1.51.
    PHP Code:

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

  7. #7
    Join Date
    Dec 2010
    Location
    UK
    Posts
    1,771
    Plugin Contributions
    3

    Default Re: Show Debug Files Automatically

    Quote Originally Posted by torvista View Post
    This is what I have, using 1.51.
    PHP Code:

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

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,420
    Plugin Contributions
    94

    Default Re: Show Debug Files Automatically

    Nice one, Steve! Thanks for sharing.

  9. #9
    Join Date
    Dec 2010
    Location
    UK
    Posts
    1,771
    Plugin Contributions
    3

    Default Re: Show Debug Files Automatically

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

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,420
    Plugin Contributions
    94

    Default Re: Show Debug Files Automatically

    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!

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. v1.51 Clean Up Debug Log Files
    By haredo in forum Code Collaboration
    Replies: 2
    Last Post: 27 Nov 2013, 12:15 AM
  2. Debug files filling up my Cache on Zen 139H
    By tbokich in forum General Questions
    Replies: 2
    Last Post: 28 Apr 2011, 07:09 AM
  3. Debug utility not writing log files
    By zhamid in forum General Questions
    Replies: 1
    Last Post: 4 Jul 2009, 02:44 PM
  4. AIM debug files in cache folder
    By earmsby in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 31 Dec 2007, 07:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR