Friday 19 August 2011 12:52:34 am - 4 replies

Introduction

So I'm trying to debug a site which has ajax calls to a module that serves xml.  Of course the debug output appended to the xml breaks it.  I've had this problem before but I never bothered looking closer at it until now.

» Read full blog post

Author Message

Damien Pobel (eZ)

Friday 19 August 2011 1:30:46 am

If a custom module/view is used to generate XML you can use to eZDebug::updateSettings() to change the debug behaviour for this view only. Another solution is to put the following code in the XML output so that the full debug is commented and does not break the XML :

<!-- <!--DEBUG_REPORT--> -->

Gaetano Giunta

Friday 19 August 2011 3:35:51 am

+1 for adding double comment marks in your templates. Do note though that if your debug output does contain charcters that are not valid xml entities, the xml will be malformed anyway.

Also note that you can use the same techinque when producing json output, by wrapping the DEBUG_REPORT tag in js comment tags: /* */

Principal Consultant International Business
Member of the Community Project Board

Thomas ZILLIOX

Tuesday 23 August 2011 2:45:31 am

Hi Steven !

Thanks for this idea. I think it's really simpler & lighter than adding comment debug in every AJAX view.

I tried your technique on a project. It works well, but I had to modify your code :

if ( preg_grep('@Content-Type: (text|application)/(xml|json).*@', headers_list() ) )
        return null;

See you,

Thomas.

--
Developer at Open Wide

Gaetano Giunta

Tuesday 23 August 2011 4:26:17 am

Btw, eZ also supports filtering the final output of the page, see OutputSettings/OutputFilterName.

You could tehn use a regexp to remove the debug output when in json/xml content. A bit of a waste of resources, as you'd be generating the debug report to remove it later on, but at least you would not have to hack the index file...

Principal Consultant International Business
Member of the Community Project Board

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 17 2025 23:38:38
Script start
Timing: Jan 17 2025 23:38:38
Module start 'layout'
Timing: Jan 17 2025 23:38:38
Module start 'content'
Timing: Jan 17 2025 23:38:38
Module end 'content'
Timing: Jan 17 2025 23:38:38
Script end

Main resources:

Total runtime0.1526 sec
Peak memory usage4,096.0000 KB
Database Queries75

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 587.9219152.6250
Module start 'layout' 0.00550.0028 740.546939.4688
Module start 'content' 0.00830.1428 780.0156715.0000
Module end 'content' 0.15110.0015 1,495.015618.3984
Script end 0.1525  1,513.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00322.0907160.0002
Check MTime0.00130.8598160.0001
Mysql Total
Database connection0.00080.540110.0008
Mysqli_queries0.075049.1500750.0010
Looping result0.00080.5540730.0000
Template Total0.122480.220.0612
Template load0.00201.307520.0010
Template processing0.120478.927420.0602
Template load and register function0.00020.110210.0002
states
state_id_array0.00171.134720.0009
state_identifier_array0.00150.956430.0005
Override
Cache load0.00161.0742260.0001
Sytem overhead
Fetch class attribute name0.00161.028680.0002
Fetch class attribute can translate value0.00050.327130.0002
class_abstraction
Instantiating content class attribute0.00000.011390.0000
XML
Image XML parsing0.00261.676630.0009
General
dbfile0.00231.5180270.0001
String conversion0.00000.006640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplforum_topic/full.tplextension/community_design/design/suncana/override/templates/forum_topic/full.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs