We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39653
    • 13 Posts
    Not sure how I missed this before, but I stumbled on to another post about writing to the MODx error log.

    Instead of any output, not I'm doing this:

    At the beginning of the plguin:

    $modx->setDebug(E_ALL & ~E_NOTICE);
    $modx->setLogLevel(modX::LOG_LEVEL_DEBUG);
    


    in the plugin, anytime I want to see what anything is set to, you can do:

    $modx->log(modX::LOG_LEVEL_DEBUG, $output);
    


    Makes for a really messy log, especially when OnParseDocument is checked, but at least it doesn't 500 on me anymore.
      • 3749
      • 24,544 Posts
      Quote from: sottwell at Dec 02, 2012, 02:34 PM
      How does one go about displaying what is available, for example displaying the SESSION array, or what values are being made available by the event?

      Different people use different methods. I generally use a function that writes to a chunk called 'Debug'.

      if (!function_exists("my_debug") && $scriptProperties['debug']) {
          function my_debug($message, $clear = false)
          {
              global $modx;
      
              $chunk = $modx->getObject('modChunk', array('name' => 'Debug'));
              if (!$chunk) {
                  $chunk = $modx->newObject('modChunk', array('name' => 'Debug'));
                  $chunk->setContent('');
                  $chunk->save();
                  $chunk = $modx->getObject('modChunk', array('name' => 'Debug'));
              } else {
                  if ($clear) {
                      $content = '';
                  } else {
                      $content = $chunk->getContent();
                  }
              }
              $content .= $message . "\n";
              $chunk->setContent($content);
              $chunk->save();
          }
      }
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting