E107 debug

From e107 Wiki
Jump to: navigation, search

e107 Wiki: English | Русский | Deutsch | Français | Magyar | Português | Български | Česky | Nederlands | Ελληνικά | Italiano | Norske | Polska | Slovenščina | Español | Svenska | Translate: Wiki | Page

logo_wiki.png

Current Release 1.0.4 | e107.org | Download | Changelog | Forum | Plugins | Themes | RSS Feed of Latest Changes | Atom Feed of Latest Changes


Development part of the e107 handbook
Main page > I : First Aid > II : Development > III : Administration > IV : How To's > V : Plugin Writing > VI : Theming & Shortcodes


Developer Information
Release Information

Class: e107_debug
File: e107_handlers/debug_handler.php

Contents

Overview

The e107_debug class has the ability to collect and display useful information about what happened during the request for a page.

This class is included by e107 (in class2.php) and does not need to be instantiated anywhere else.

Debug info is only available to administrators or if Developer Mode is switched on (see Site Preferences and heed the warning for Developer Mode).

Debugging is enabled using URL parameters of the form [debug=debuglevel], for example: /mydomain.com/news.php?[debug=all]. Available debug level tags are detailed below. If no debug level is specified debugging will default to everything.

In addition you can turn on debugging for the current and all subsequent pages by using the stick parameter:

/mydomain.com/news.php?[debug=all,stick]
/mydomain.com/news.php?[debug=all+]

Turn off debugging using the unstick parameter:

/mydomain.com/news.php?[debug=all,unstick]
/mydomain.com/news.php?[debug=all-]

When debuggging is turned on, the information collected is displayed at the bottom of the page (from footer_default.php).

The easiest way to debug in e107, is to login as admin and then use the e107 Debugger Firefox addon.

Debugging Information

Note: The parenthetical numbers below are raw debug-enable values. These can be summed to create your own custom debug display.

Basic Displays

PHP Errors (1)
Shows PHP errors, warnings and notices.
SQL Query List (2)
Shows each database query, how long it took and the source file and line number that executed the query.
Traffic Counts (4)
Shows usage-counts of certain core functions. Currently the traffic counts are mostly used to measure various database class methods.

Detail Displays

These debug information displays provide advanced, detailed information to help with performance tuning and resolving difficult bugs.

Time Analysis (256)
For each element of the current web page, provides a breakdown of work involved in generating that part of the page:
  • Number of DB queries (and percent of total)
  • Time spent in DB queries (and percent of total)
  • Time spent other than in DB queries (and percent of total)
  • Number of bytes of HTML generated
SQL Analysis (512)
Shows detailed information about each query (using MySQL 'EXPLAIN', including
  • Tables used
  • Optimizations performed
  • Hints for possible performance improvements (such as fields that ought to be indexed.)
  • Other query-dependent explanations
Paths (1024)
Shows configured path information - server path, e107 directories, etc.
Shortcodes/BBCode Sequence (2048)
Enables shortcode and BB code debugging --
  • Provides a table of shortcodes and BB Codes that have been used, with detailed parameter analysis.
  • Inserts shortcode/bbcode processing notices into the PHP notice list, enabling the developer to see the source of PHP errors.
Shortcode Filenames (4096)
Dumps Shortcode filenames, as used, inline with generated HTML (intended for internal use only)
Deprecated Functions (16384)
Shows any deprecated (outdated, replaced by newer) functions that have been called.

Debugging Level Tags

Notes

  • The debug= parameter is normally set with one of these tags. The default [debug] is everything.
  • You can also use numeric debug levels by summing the level values noted above. I.e. [debug=7] will show all basic debug info. [debug=255] will show today's and future basic-level debug info.
  • If any debug info is specified, the debug display will also show all PHP Errors and Notices.

Basic Debug Info Tags

all / basic / b
All three of these are aliases for the same thing: to show all basic debugging information:
  • PHP Errors (Notice level and up)
  • SQL Query List
  • Traffic Counters
warn
Shows PHP Errors (and Notices??!)
showsql
Shows SQL Analysis
counts
Shows traffic counters

Detail Debug Info Tags

detail / d
These are both aliases to show all detailed debug information --
  • Detailed performance analysis
  • Detailed SQL query analysis
  • Configured e107 paths
  • Detailed shortcode/bbcode analysis
  • Shortcode inline filename dump
  • Deprecated function-call details
time
Display detailed performance analysis
sql
Display detailed SQL query analysis
paths
Display e107 paths as configured
bbsc
Display detailed shortcode/bbcode analysis
sc
Display shortcode filenames inline
deprecated
Display details of deprecated function calls
notice
(same as warn above)

The Whole Enchilada

everything (current default)
Shows all basic AND all detailed debug info

Firefox & Google Chrome e107 Debug Add-on

Great News, is that there is now a Google Chrome Extension too. When using Firefox or Chrome as your Internet browser you can install a nifty add-on that gives you a handy e107 icon in the status bar at the bottom of your screen.

When you're logged in at your e107 website you can use it and use easily all the debug possibilities from e107 by a simple click of your mouse.

Download e107 debugger:

https://addons.mozilla.org/en-US/firefox/addon/13016

https://chrome.google.com/extensions/detail/nckmapjibjdehbfpfimgeafbekochdpa?hl=en

NOTE: The FireFox setting View > Status Bar must be checked to visibly see the add-on.

Using the e107 debug tool

Once you have downloaded the e107 debug tool

  • Login to your site as admin
  • Left Click the Cube at the bottom right of the browser in Firefox or Top right in Chrome next to the 'Spanner'
  • Choose from the various debug options, there are more options, which will be documented at a later time.
    • The Basics - shows minimal information which you will likely need to troubleshoot an issue.
    • Notices - displays any "Notice Level" debug information.
    • Warnings - displays more critical errors.
  • All Details - shows all debug data - a very big list of stuff.

Next Navigate to your problem page and look for notice, warnings or other errors listed at the bottom of your website.

There are occasions where the problem exists when logged out. In this case you may need to temporarily run in developer mode (see Preferences), but this puts your site at risk of damage, so avoid this and ideally run this only on a private server, at home or from a password protected folder on your server. Ensure you disable developer mode as soon as you have collected the information.