In case other people want to use this, I’m now currently using the following:
To report errors to the MODx error log:
trigger_error('...', E_USER_ERROR);
To report warnings to the MODx error log:
trigger_error('...', E_USER_WARNING);
To sent debug information to the MODx error log:
$modx->log(modX::LOG_LEVEL_DEBUG, '...');
The MODx error log can be found in the MODx manager->Reports->Errorlog.
To get the debug and error output use statements like the following:
$modx->setDebug(E_ALL & ~E_NOTICE); // sets error_reporting to everything except NOTICE remarks
$modx->setLogLevel(modX::LOG_LEVEL_DEBUG);