We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2690
    • 148 Posts
    Hello all,

    Can anybody explain these settings in the main config file:

    if (!defined('MODX_LOG_LEVEL_FATAL')) {
        define('MODX_LOG_LEVEL_FATAL', 0);
        define('MODX_LOG_LEVEL_ERROR', 1);
        define('MODX_LOG_LEVEL_WARN', 2);
        define('MODX_LOG_LEVEL_INFO', 3);
        define('MODX_LOG_LEVEL_DEBUG', 4);
    }


    Is there a way to turn off Error reporting altogether?

    Thank you!
      MODx Revo 2.0.6-pl (Traditional) | Apache 2.2.3 | PHP 5.2.14 | MySQL 5.0.77 | MAC OS 10.6.5 | FF 3.6/Chrome 9.0.5
      • 3749
      • 24,544 Posts
      Those are constants used as arguments to the $modx->log() function to tell it what kind of error it’s processing.

      I don’t think there’s a way to totally disable error logging, but I could be wrong.

      What kind of errors are you getting? There may be a way to stop them from occurring.
        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
        • 2690
        • 148 Posts
        getting tons of duplicate aliases errors and i just want to suppress them so they dont clog the log file...
        (i know i need to fix the resources, but for now i would want to just filter them out)

        Thanks!
          MODx Revo 2.0.6-pl (Traditional) | Apache 2.2.3 | PHP 5.2.14 | MySQL 5.0.77 | MAC OS 10.6.5 | FF 3.6/Chrome 9.0.5
          • 3749
          • 24,544 Posts
          Have you tried setting the allow_duplicate_alias System Setting to Yes?

          BTW, this snippet should list them for you (and optionally fix them). smiley

          This is untested and you should back up the modx_site_content table (by exporting it in PhpMyAdmin) if you’re going to use the
          code that fixes them. The listing code should be harmless.

          <?php
          /* ListDuplicateAliases snippet */
          
          $fix = false; /* set to true to fix them */
          
          $resources = $modx->getCollection('modResource', array('deleted'=>'0'));
          $output = 'Resources with duplicate aliases<br />';
          foreach($resources as $resource) {
              if ($resource->isDuplicateAlias()) {
                  $output .= '<br /><br />Pagetitle: ' . $resource->get('pagetitle');
                  $output .= '<br />alias: ' . $resource->get('alias');
                 /* optional  -- fix it by creating autoalias and, if that doesn't work, 
                      add a unique string to the end of the alias
                 */
          
                if ($fix) {
                      $oldAlias = $resource->get('alias');
                      $newAlias = $resource->get('pagetitle');
                        /*MODx will convert it to an auto alias based on the pagetitle here */
                      $resource->set('alias', $newAlias);
          
                      if ($resource->isDuplicateAlias()) { 
                         /* still no good */
                          $newAlias =  $oldAlias . '-' .  time()
                          $resource->set('alias' ,  $newAlias);
                      }
                      $output .= '<br />Alias changed to: ' .  $newAlias;
                      resource->save();
                }
          
              }
          }


          If you run the change code, you’ll still get a complete record of all the dupes and what they were changed to so you can make any necessary adjustments in ones you don’t like.
            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