Hope this is the right forum and someone is interested and perhaps this isn't covered anywhere else?
I was always a bit annoyed about the XOOPS-internal debugging especially when working with (x)ajax. This gives you always (mostly) problems.
So I ended up using FireBug + FirePHP as addons for Firefox. I rewrote class/logger/render.php to output the debug to FirePHP. With this solution you are highly flexible.
As a module developer you can write any kind of debug notice you want without destroying the layout with echos or even writing to a logfile.
Example:
le="color: #000000"><?php $fb->log($thevariwanttodisplay);
Of course you could adapt render.php to your needs like displaying server vars etc.
You can get FirePHP
HEREAnd here is the code for class/logger/render.php (hope the textsanitizer won't mess up):
<?php /** * XOOPS Logger renderer * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. * 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. * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @package kernel * @subpackage logger * @since 2.3.0 * @author Skalpa Keo <skalpa@xoops.org> * @author Taiwen Jiang <phppp@users.sourceforge.net> * @version $Id: render.php 2633 2009-01-10 03:09:41Z phppp $ * * @todo Not well written, just keep as it is. Refactored in 3.0 */ defined( 'XOOPS_ROOT_PATH' ) or die(); //ob_start(); global $xoopsUser; if (is_object($xoopsUser)) { require_once XOOPS_ROOT_PATH.'/FirePHPCore/FirePHP.class.php'; $fb = FirePHP::getInstance(true); $ret = ''; $this->addExtra( 'Included files', count ( get_included_files() ) . ' files' ); $memory = 0; if ( function_exists( 'memory_get_usage' ) ) { $memory = memory_get_usage() . ' bytes'; } else { $os = isset( $_ENV['OS'] ) ? $_ENV['OS'] : $_SERVER['OS']; if ( strpos( strtolower( $os ), 'windows') !== false ) { $out = array(); exec('tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $out ); $memory = substr( $out[5], strpos( $out[5], ':') + 1) . ' [Estimated]'; } } if ( $memory ) { $this->addExtra( 'Memory usage', $memory ); } if ( empty($mode) || $mode == 'errors' ) { $types = array( E_USER_NOTICE => 'Notice', E_USER_WARNING => 'Warning', E_USER_ERROR => 'Error', E_NOTICE => 'Notice', E_WARNING => 'Warning', E_STRICT => 'Strict', ); $fberrors = array(); foreach ( $this->errors as $error ) { $fberrorstype = isset( $types[ $error['errno'] ] ) ? $types[ $error['errno'] ] : 'Unknown'; $fberrors[] = array($fberrorstype.sprintf( ": %s in file %s line %s", $this->sanitizePath($error['errstr']), $this->sanitizePath($error['errfile']), $error['errline'] )); } if (!empty($fberrors)) $fb->table('Errors', $fberrors); } if ( empty($mode) || $mode == 'queries' ) { $fbqueries = array(); $pattern = '/b' . preg_quote($GLOBALS['xoopsDB']->prefix()) . '_/i'; foreach ($this->queries as $q) { $sql = preg_replace($pattern, '', $q['sql']); if (isset($q['error'])) { $fbqueries[] = array(htmlentities($sql).' Error number: '.$q['errno'].' Error message: '.$q['error']); } else { $fbqueries[] = array(htmlentities($sql)); } } $fbqueries[] = array('Total: '.count($this->queries).' queries'); $fb->table('Queries', $fbqueries); } if ( empty($mode) || $mode == 'blocks' ) { $fbblocks = array(); foreach ($this->blocks as $b) { if ($b['cached']) { $fbblocks[] = array(htmlspecialchars($b['name']).': Cached (regenerates every '.intval($b['cachetime']).' seconds)'); } else { $fbblocks[] = array(htmlspecialchars($b['name']).': No Cache'); } } $fbblocks[] = array('Total: '.count($this->blocks).' blocks'); if (count($this->blocks) > 0) $fb->table('Blocks', $fbblocks); } if ( empty($mode) || $mode == 'extra' ) { $fbextra = array(); foreach ($this->extra as $ex) { $fbextra[] = array(htmlspecialchars($ex['name']).': '.htmlspecialchars($ex['msg'])); } $fb->table('Extra', $fbextra); } if ( empty($mode) || $mode == 'timers' ) { $fbtimers = array(); foreach ( $this->logstart as $k => $v ) { $fbtimers[] = array(htmlspecialchars($k).' took ' . sprintf( "%.03f", $this->dumpTime($k) ) . ' seconds to load.'); } $fb->table('Timers', $fbtimers); } } ?>
Output is still looking a bit ugly, but better than before.
Hope this is helpful to someone?
edit: added the query for xoopsUser in order to hide the debug for guests