evolution-cms / evolution

Welcome to the new evolution of MODX Evolution!
GNU General Public License v3.0
260 stars 96 forks source link

How to display debug information (DB queries/execution times) with Evolution CMS? #1404

Open q2apro opened 4 years ago

q2apro commented 4 years ago

I am currently running Evolution CMS 1.4.11 and would like to output debug information, mainly to see the mysql queries and to improve performance.

From another PHP framework, I found this (example):

image

And below this table, all mysql queries are listed with execution times, e.g. "SELECT ..." and "0.31 ms - 2 rows - 3 columns".

How to do the same with Evolution CMS?

sashabeep commented 4 years ago

@q2apro as always

Memory: [^m^], MySQL: [^qt^], [^q^] request(s), PHP: [^p^], total: [^t^], document retrieved from [^s^].

http://www.evolution-docs.com/documentation/content-editing/cms-tags/#EvoTags-Timing

q2apro commented 4 years ago

Thanks! ❤ So that can go directly into the doc resource, cool.

[^qt^] - Query Time - Shows how long Evo took talking to the database [^q^] - Query Count -Shows how many database queries Evo made [^p^] - Parse Time - Shows how long Evo took to parse the page [^t^] - Total Time - Shows the total time taken to parse/ render the page [^s^] - Source - Shows the source of page, whether is database or cache.

Would be great to have the keyword "debug"/"debugging" on this site, to be able to find it.

Or in best case a page that documents the entire debugging possibilities of Evo CMS / best practice.


Last:

  1. How can I output the queries? [^q^] just gives me the mysql query count.

  2. It seems EVO is only tracking its own query functions, I have some queries that do not use $modx->getDocumentChildren() etc. - So they are not tracked?

sashabeep commented 4 years ago

@q2apro

It seems EVO is only tracking its own query functions, I have some queries that do not use $modx->getDocumentChildren() etc. - So they are not tracked?

to be clear i dunno, tried some calls using dbapi - shows 0 queries. That is pretty strange.

$out='';
$table = $modx->getFullTableName( 'site_content' );
$result = $modx->db->select( 'id,pagetitle', $table, '', 'id ASC', '' );
$members = $modx->db->makeArray( $result );
foreach( $members as $p_val ) { 
        foreach( $p_val as $m_key => $m_val ) { 
            $out .= '<span class="text-bold">' . $m_key . ':</span> ' . $m_val . '<br>'; 
        } 
    } 

return($out);

On the 2.0.x there is tracy helper that shows some info Снимок экрана 2020-03-16 в 12 06 47

when [^qt^] and [^q^] showing zeroes

Снимок экрана 2020-03-16 в 12 04 27

sashabeep commented 4 years ago

@q2apro the same call on 1.4.9 Снимок экрана 2020-03-16 в 12 18 29

sashabeep commented 4 years ago

@q2apro looks like on the 1.4.11 is working too as reported in our chat. On the 2.0.x is not working cause it's covered by tracy. btw, please join https://t.me/evolutioncms for any further support and tips

q2apro commented 4 years ago

Well, I had liked to ask at stackoverflow.com but the last question I asked stayed without answer.

https://stackoverflow.com/questions/tagged/evolution-cms

A Telegram group? Why not to have the answers public?

risingisland commented 4 years ago

I too dont understand why we need an app instead of a public forum. We (for the most part) are developing via PC, not phone. Even Slack seems to have been more or less abandoned, with the exception of a post from the latest update.

sashabeep commented 4 years ago

@q2apro @risingisland for now is the fastest way to post your questions and get it answered. Or you can post your thoughts on modx.im

@risingisland mee to developing on laptop, of course. https://desktop.telegram.org/

IMO Github is not for forums, but for now there is no active multilingual community (and up-to date documentation on english too), if you have any opinions about future vision of community you can contact with @Dmi3yy

risingisland commented 4 years ago

Thank you for the info Sasha :thumbsup:

q2apro commented 4 years ago

As hard as it sounds: Force the community to use English and to ask at stackoverflow.com - Many projects use SO for Q&As nowadays.