johnbillion / query-monitor

The developer tools panel for WordPress
https://querymonitor.com
GNU General Public License v2.0
1.58k stars 207 forks source link

Timings&Logs - No data logged #826

Closed cpanti closed 9 months ago

cpanti commented 10 months ago

Nothing is logged under Timings or Logs. do_action function is called with qm/debug, qm/start and qm/stop. My error_log ($VH_ROOT/logs/$VH_NAME.error_log) doesn't show anything.

Anything else is working properly.

I don't know how to debug it. Webserver: litespeed Any idea where to start from? Thank you, Catalin

johnbillion commented 10 months ago

Are you sure the code path that contains those actions is running? For example, try putting some other debugging output immediately before it such as a var_dump( $value) followed by exit.

cpanti commented 10 months ago

Absolutely @johnbillion. I'm also using error_log to debug my code. I also added some error_log commands in QM plugin (exemple class QM_Timer - Start) and I see them.

image image

johnbillion commented 10 months ago

Does this code fire directly within the current page load or does it happen inside an Ajax request?

cpanti commented 10 months ago

it is a Ajax call. I'm calling an wordpress plugin endpoint. image

        jQuery.ajax({
            url: endPointOrigin+"/wp-admin/admin-ajax.php?action=SurveyJS_GetSurveyJson",
            type: "POST",
            data: {
                Id: mySurveyId,
                cf_token: token,
                href: window.location.href,
            },
            success: function(data) {
crstauf commented 9 months ago

Timings and logs made in an AJAX call currently are not added to the QM panel.

cpanti commented 9 months ago

Thank you John. Two questions:

  1. you said currently. any plans to include it in the near future?
  2. what is in your opinion the best alternative for jQuery.ajax on Wordpress?
crstauf commented 9 months ago

Actually I'm not the owner of the plugin, just help out.

I don't think it's on the roadmap for the near future, but it has been mentioned before.

There are a few approaches you can take to initiate an AJAX call, the most modern probably being fetch().

johnbillion commented 9 months ago

Debugging requests outside of the current page load is definitely the to-do list, but no ETA just yet.