Zen Cart Logo
Forums / All Other Contributions/Addons / myDEBUG Backtrace [Support Thread]

myDEBUG Backtrace [Support Thread]

Views: 8,702

Results 1 to 20 of 45
19 Jun 2014, 6:40 PM
#1
lat9 avatar

lat9

Administrator

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

myDEBUG Backtrace [Support Thread]

This plugin builds on the suggestion I made to have the database's query_factory class include a debug_backtrace when a database interface error is detected, to aid in problem determination. There are other cases when a Zen Cart myDEBUG*.log file is created in which a "victim" (usually one of the Zen Cart built-in functions) is identified, but the "culprit" is actually the function's caller. This plugin updates the Zen Cart's built-in error handling (both admin- and store-side) to include a PHP debug_backtrace as part of the debug-log. That is, instead of receiving:

[19-Jun-2014 20:19:22] PHP Warning:  strtr() [function.strtr]: The second argument is not an array in C:\xampp\htdocs\testing\includes\functions\functions_general.php on line 64

you'll receive the following log from which you can easily determine the "culprit" (/includes/init_includes/init_item.php):

[19-Jun-2014 20:19:22] #1  strtr() called at [C:\xampp\htdocs\testing\includes\functions\functions_general.php:64]
#2  zen_parse_input_field_data() called at [C:\xampp\htdocs\testing\includes\init_includes\init_item.php:8]
#3  require(C:\xampp\htdocs\testing\includes\init_includes\init_item.php) called at [C:\xampp\htdocs\testing\includes\autoload_func.php:48]
#4  require(C:\xampp\htdocs\testing\includes\autoload_func.php) called at [C:\xampp\htdocs\testing\includes\application_top.php:150]
#5  require(C:\xampp\htdocs\testing\includes\application_top.php) called at [C:\xampp\htdocs\testing\index.php:26]


[19-Jun-2014 20:19:22] PHP Warning:  strtr() [function.strtr]: The second argument is not an array in C:\xampp\htdocs\testing\includes\functions\functions_general.php on line 64

I'll be submitting this to the Plugins area shortly and will post back the download link once I've received it!

19 Jun 2014, 7:00 PM
#2
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

The plugin will be available here, once approved: http://www.zen-cart.com/downloads.php?do=file&id=1879

29 Jun 2014, 12:58 PM
#3
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

Now available for download ...

10 Aug 2014, 4:04 AM
#4
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: myDEBUG Backtrace [Support Thread]

Quick question to help identify how soon I should consider installing this (because I will regardless), I have been getting debug logs regarding duplicate cache entries for some time now, it started in 1.5.0 and while less frequent continues to appear in ZC 1.5.1. Is it likely that this additional debugging code would help identify where/why that is happening? I don't need to discuss the issue her that's for another threade, I'm just wondering about this plugin and if I should install it now to try to pinpoint the issue better by beginning some more history collection or if it is not likely to help for this one particular issue.

10 Aug 2014, 11:35 AM
#5
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

This plugin with help identify the cause of what I've termed "victim reports" in the debug log files, i.e. a debug-log file that reports an error in a class or function when the issue actually lies in the parameters supplied by the caller of the function.

11 Aug 2014, 12:54 PM
#6
devyani avatar

devyani

Zen Follower

Join Date:
Aug 2011
Posts:
199
Plugin Contributions:
0

Re: myDEBUG Backtrace [Support Thread]

I have installed this. Where can I see the logs ?

11 Aug 2014, 1:27 PM
#7
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

You'll only see the log-files (either in your /cache folder if you're running v1.5.0 or the /logs folder for v1.5.1+) if there's a PHP-related issue.

11 Aug 2014, 1:48 PM
#8
devyani avatar

devyani

Zen Follower

Join Date:
Aug 2011
Posts:
199
Plugin Contributions:
0

Re: myDEBUG Backtrace [Support Thread]

I am running 1.5.1.
I checked both the logs and cache folder. I do not see any entry there. I mean there are logs in logs folder, but not for today's or last week's date.
Am I doing the right thing? I have just taken backup and copied the files. And to reproduce the error, I clicked on the link which was giving error:

http://bambino.co.in/index.php?main_page=products_new
http://bambino.co.in/index.php?main_page=products_all
http://bambino.co.in/index.php?main_page=specials
... and so on

and then looked in the logs folder.
What should I do to solve this ?

11 Aug 2014, 4:07 PM
#9
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

Use your admin's Tools->Developers Tool Kit to search for *select count(distinct ) as total in all Admin/Catalog files. What file(s) show as containing that code fragment?

13 Aug 2014, 3:55 AM
#10
devyani avatar

devyani

Zen Follower

Join Date:
Aug 2011
Posts:
199
Plugin Contributions:
0

Re: myDEBUG Backtrace [Support Thread]

I checked, there is no result for this match. I am searching in the last option (Look-up in all files) of the developer's tool kit & as advised by you, I am selecting both catalogue and admin files . Also I have selected both php and css.

13 Aug 2014, 12:46 PM
#11
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

devyani:

I checked, there is no result for this match. I am searching in the last option (Look-up in all files) of the developer's tool kit & as advised by you, I am selecting both catalogue and admin files . Also I have selected both php and css.
Hmm, for right now, I suggest that you start a different thread with the issue that you have (it's not with the backtrace plugin).

14 Aug 2014, 5:52 AM
#12
devyani avatar

devyani

Zen Follower

Join Date:
Aug 2011
Posts:
199
Plugin Contributions:
0

Re: myDEBUG Backtrace [Support Thread]

Okies :(

7 Jan 2015, 12:03 AM
#13
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: myDEBUG Backtrace [Support Thread]

There is a difference in one common file used in two of your modules, and I'm not sure which one is the RIGHT one..
display_logs-1.0.9.zip\display_logs-1.0.9\YOUR_ADMIN\display_logs.php says:
```

<div id="dSel"><?php echo zen_image_submit(BUTTON_DELETE_SELECTED, DELETE_SELECTED_ALT, 'name="dButton" value="delete" onclick="return buttonCheck(\'delete\');"'); /*v1.0.6c*/ ?></div> <div id="dAll"><?php echo zen_image_submit(BUTTON_DELETE_ALL, DELETE_ALL_ALT, 'name="sButton" value="all" onclick="return buttonCheck(\'all\');"'); /*v1.0.6c*/ ?></div> ```

mydebug_backtrace-v1.0.0.zip\mydebug_backtrace\YOUR_ADMIN\display_logs.php says:

            <div id="dSel"><?php echo zen_image_submit(BUTTON_DELETE_SELECTED, DELETE_SELECTED_ALT, 'name="dButton" value="delete" onclick="return buttonCheck(this.value);"'); ?></div>
            <div id="dAll"><?php echo zen_image_submit(BUTTON_DELETE_ALL, DELETE_ALL_ALT, 'name="sButton" value="all" onclick="return buttonCheck(this.value);"'); ?></div>

Which one is correct??? I am ASSUMING it's the one from display_logs-1.0.9.zip

7 Jan 2015, 2:18 PM
#14
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

Well, :censored:, where did those files come from? You're correct, Diva, that you should use the files from the Display Debug Logs plugin and I'll resubmit the myDEBUG Backtrace zip-file to remove those tag-alongs. Thanks for taking the time to let me know!

7 Jan 2015, 2:35 PM
#15
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: myDEBUG Backtrace [Support Thread]

lat9:

Well, :censored:, where did those files come from? You're correct, Diva, that you should use the files from the Display Debug Logs plugin and I'll resubmit the myDEBUG Backtrace zip-file to remove those tag-alongs. Thanks for taking the time to let me know!

hahahahaha it happens.. By the by, the myDEBUG Backtrace module + this module saved me a MASSIVE headache yesterday.. Found an error with these two I would not have OTHERWISE found.. PURE GOLD!!!! These are NOW "must install" modules forever for me!!!

You KNOW you rock right????:smile:

7 Jan 2015, 2:40 PM
#16
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

Thanks muchly, Diva. I've submitted v1.0.1 to the Plugins ... with the stray files removed.

10 Jan 2015, 1:02 AM
#17
batteryman avatar

batteryman

Zen Follower

Join Date:
Jul 2004
Location:
Las Vegas
Posts:
327
Plugin Contributions:
0

Re: myDEBUG Backtrace [Support Thread]

Will this work for 1.3.9 installs even though it is designated for 1.5+

10 Jan 2015, 2:06 PM
#18
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

batteryman:

Will this work for 1.3.9 installs even though it is designated for 1.5+
It *should *work just fine. Just be sure to backup the two (possibly) overwritten files before you install.

18 Jan 2015, 2:02 PM
#19
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

lat9:

Thanks muchly, Diva. I've submitted v1.0.1 to the Plugins ... with the stray files removed.
v1.0.1 is now available for download ...

30 Jan 2015, 4:52 PM
#20
lat9 avatar

lat9

Administrator

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

Re: myDEBUG Backtrace [Support Thread]

Oopsie! I've just submitted v1.0.2 to the plugins' area; it will be available for download once reviewed.

The admin-level file (/YOUR_ADMIN/includes/extra_configures/enable_error_logging.php) mistakenly removed the -adm distinction on log file names generated during admin-level accesses. To implement the correction, find the following fragment in that file:

/**
 * The path where the debug log file will be located
 * Default value is: DIR_FS_LOGS . '/myDEBUG-999999-00000000.log'
 * ... which puts it in the /logs/ folder:   /logs/myDEBUG-999999-00000000.log  (where 999999 is a random number, and 00000000 is the server's timestamp)
 *    (or if you don't have a /logs/ folder, it will use the /cache/ folder instead)
 */
  $debug_logfile_path = DIR_FS_LOGS . '/myDEBUG-' . time() . '-' . mt_rand(1000,999999) . '.log';

and make the teeny modification shown below:

/**
 * The path where the debug log file will be located
 * Default value is: DIR_FS_LOGS . '/myDEBUG-999999-00000000.log'
 * ... which puts it in the /logs/ folder:   /logs/myDEBUG-999999-00000000.log  (where 999999 is a random number, and 00000000 is the server's timestamp)
 *    (or if you don't have a /logs/ folder, it will use the /cache/ folder instead)
 */
  $debug_logfile_path = DIR_FS_LOGS . '/myDEBUG-[B]adm-[/B]' . time() . '-' . mt_rand(1000,999999) . '.log';