Für das Debuggen innerhalb von WordPress gibt es verschieden Ansätze und Vorlieben. Ich mag xDebug und in einigen Fällen nutze ich FirePHP. Nun ist ein weitere Möglichkeit in meinen Fokus gerückt und ich musste es zumindest mal testen - debugConsole - es gefällt mir.
The debugConsole is a tool for debugging and tracing PHP5 applications on productive servers without compromising the live-traffic.
Warum also nicht auch hier und darum hier eine kleiner Hinweis und ein kleines erstes Plugin zum spielen und testen der Konsole.

Aktuell habe ich nur ein Demo-Plugin erstellt, was die Funktion zeigt. Es wird auch nicht gepflegt, kann aber hier herunter geladen werden. Als kleiner Start quasi und schneller Blick auf die Möglichkeiten. Ich habe dabei die Beispiele des Autors der debugConsole integriert.
Das Plugin hat folgenden Quellcode und ihr könnt an jeder URL aus der WP-Installation den String ?debug=true anhängen, so dass das Popup mit den Informationen der Konsole aufgerufen wird. Aktuell ist dies für Frontend und Backend möglich.
<?php
/*
Plugin Name: debugConsole
Plugin URI: http://bueltge.de/
Text Domain: debugconsole
Domain Path: /languages
Description: The <a href="http://www.debugconsole.de/">debugConsole</a> is a tool for debugging and tracing PHP5 applications on productive servers without compromising the live-traffic. Add <code>?debug=true</code> to the URL for see the Popup-Window with debugConsole
Author: Frank Bültge
Version: 0.1
Author URI: http://bueltge.de/
Donate URI: http://bueltge.de/wunschliste/
License: Apache License
Last change: 14.10.2010 11:30:51
*/
/**
License:
==============================================================================
Copyright 2010 Frank Bueltge (email : frank@bueltge.de)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Requirements:
==============================================================================
This plugin requires WordPress >= 2.7 and tested with PHP Interpreter >= 5.2.9
*/
/* PHP5 required */
if (version_compare(PHP_VERSION, '5.0.0') < 0) {
die('The debugConsole requires PHP 5.x.x or greater.');
}
/* load debugConsole functionality */
require_once 'debugconsole-1.3.0/debugConsole.php';
// add ?debug=true to the URL
if ( isset($_GET['debug']) && $_GET['debug'] == 'true') {
add_action( 'wp_footer', 'wp_debug_console' );
add_action( 'admin_footer', 'wp_debug_console' );
}
function wp_debug_console() {
/**
* debugConsole demonstration
*
* This script demonstrates each feature of the debugConsole. The
* debugConsole is a PHP5 class using JavaScripts to show debug
* information in a popup window. The popup has IP-based access
* control. Configurate everything in debugConsole.config.php.
* Additionally, PHP's default errorhandler is replaced.
*
* @author Andreas Demmer <mail@andreas-demmer.de>
* @version 1.0.1
* @package debugConsole_1.2.0
*/
/*
Now you got an extended commandset:
dc_watch() watch variable changes in console
dc_dump() var_dump variables in console
dc_here() mark checkpoints in console
dc_start_timer() measure a timespan
dc_stop_timer() output timespan in console
*/
/* test watches */
dc_watch('foo');
declare (ticks = 1) {
$foo = '1';
$foo++;
/* test checkpoints */
dc_here('The interpreter passed through here!');
/* test timer clock */
$myTimer = dc_start_timer('Measure an one second sleep:');
sleep(1);
dc_stop_timer($myTimer);
/* test variable debugging */
$bar = 42.0;
dc_dump($bar, '$bar tells us the meaning of life:');
$foobar = array (
'foo' => $foo,
'bar' => $bar
);
dc_dump($foobar, '$foobar is a neat array!');
/* test errorhandling */
echo $notSet;
fopen('not existing!', 'r');
}
}
?>
Download:
Ist die Arbeit nicht 1 Euro wert?
Jede Spende wird dankbar angenommen und ermöglicht das weitere Arbeiten an freier Software.
Möchtest du mehr oder anders spenden, so besuche meine Wunschliste.
Download als zip-Datei: debugConsole.zip - 131 kByte
Ich hab bisher auch meistens xDebug verwendet. Aber irgendwie bin ich damit nie richtig warm geworden. Daher werde ich mir auf jeden Fall einmal debugConsole anschauen.
Gruß Marc
Probieren geht über studieren würd ich sagen werd mich die console die tage mal testen
Danke
Ah, super! Die debugConsole werde ich bestimmt brauchen, wenn ich mich endlich mal wieder an ein Update meines Blogs mache...
Ich bin noch recht neu in der Welt von WordPress, aber bisher hat mir firephp am besten gefallen. Vllt wird debugconsole ja eine mögliche Alternative.
Ich habe es angetestet und finde es ehrlich gesagt ziemlich kompliziert.
Ah, super! Die debugConsole werde ich bestimmt brauchen,
Werde ich bestimmt testen! Danke!
Gruß
Peter
Danke für die Anregung. Ich werd es mal ausprobieren sobald ich genug Zeit habe mich intensiv damit zu beschäftigen.
Ich wollte demnächst einen WordPress Blog einrichten, da kommen mir solche Tipps sehr gelegen.
Vielen Dank.
Also ich finde das ist wohl eine bessere Alternative wie xDebug, daher werde ich das auch mal Testen. Man bastelt ja schon oft an seinem Blog
Hab die Console getestet, aber jedes mal bekomme ich ein Verbindungsfehler. Woran kann das liegen?
Gefällt mir sehr gut, danke für deine Arbeit. Ist imo auch mehr als 1 Euro wert
Hallo,
vielen Dank für das kleine Beispiel-Plugin.
VG Peter