ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Error Reporting Settings Heartache

April 19, 2011 3:05am

Subscribe [4]
  • #1 / Apr 19, 2011 3:05am

    truthnews

    37 posts

    How do I override the EE2 control panel settings for error reporting? (v2.1.3).

    The Debug Preference in the CP has only 2 states, “on” or “off”, but I want to achieve something like this:

    error_reporting(E_ALL);
    ini_set('log_errors', '1');
    ini_set('display_errors', '0');

    I have tried putting the above in the index.php startup file - but it is (apparently) overridden by the EE CP setting.

    NOTE: this has nothing to do with server restrictions - these settings work fine outside of EE.

    Do I need to hack EE in some way to fix this? - it’s a big problem right now in testing our site becasue the options in the CP are not useful. The “on” setting shows all errors including trivial notices (which break the layout of the page) and the “off” setting hides everything.

    NOTE - I found this function in libraries/Core.php

    function _enable_debugging()
    {
      $this->EE->db->db_debug = TRUE;
      error_reporting(E_ALL);
      @ini_set('display_errors', 1);    
    }

    I tried changing the ‘display_errors’ setting to @ini_set(‘display_errors’, 0) - but this had no effect.

    Thanks!

  • #2 / Apr 19, 2011 5:47pm

    Brandon Jones

    5500 posts

    Hi truthnews,

    What do you have set for $debug in your root index.php and system/index.php files? Try setting those to 1.

  • #3 / May 04, 2011 2:37am

    truthnews

    37 posts

    Hi truthnews,

    What do you have set for $debug in your root index.php and system/index.php files? Try setting those to 1.

    I would really appreciate a serious answer to my question. I have tried all the obvious things including the suggestion above.

    I have recently discovered a new problem which forces me to set the “output and debugging” setting to “1”, causing error notices to spew out on the screen.

    Apparently, text in curly brackets does not render if you set error reporting to “0” in the CP.

    Now I am really in a double bind. It makes testing of the website impossible because these notices keep popping up if you are logged in as super admin. The notices need to be able to be piped to a log file rather than displayed on screen.

    There is something in the EE framework which is making this impossible.

    Need help!

    Thanks.

  • #4 / May 04, 2011 4:29am

    narration

    773 posts

    truthnews, what complicates anyone giving responses here is that normally with EE there is no need to split debugging levels.

    In other words, you should not be getting interfering PHP errors at any time.

    If you are, then the underlying problem needs to get fixed, so that your site can be reliable.

    That said, here is a workaround that can let you set debug to 0 without interfering with curly braces such as JSON variables.

    I would emphasize that using this should be a very temporary measure. PHP errors may have simple causes, but their results can be potentially quite serious. You could end up with an unusable site, as a real potential.

    Please balance the risks accordingly, and get the real problem sorted asap. My hope is that this will help you get the pressure off so you can do that.

    EE support can help you as necessary about using log file logging.

    Regards,
    Clive

  • #5 / May 04, 2011 7:09am

    John Henry Donovan

    12339 posts

    truthnews,

    I have tried putting the above in the index.php startup file - but it is (apparently) overridden by the EE CP setting.

    That will not work with EE2.x as you have found out and is for EE1.x only

    We would recommend you keeping your debugging set at ‘1’ in your Control Panel Output and Debugging preferences but if you wish error message to show to admins then change your $debug in your root index.php to 1

    If you wish to log errors then open up your system/expressionengine/config/config.php and uncomment one of these options

    /*
    |--------------------------------------------------------------------------
    | Error Logging Threshold
    |--------------------------------------------------------------------------
    |
    | If you have enabled error logging, you can set an error threshold to 
    | determine what gets logged. Threshold options are:
    |
    |    0 = Disables logging, Error logging TURNED OFF
    |    1 = Error Messages (including PHP errors)
    |    2 = Debug Messages
    |    3 = Informational Messages
    |    4 = All Messages
    |
    | For a live site you'll usually only enable Errors (1) to be logged otherwise
    | your log files will fill up very fast.
    |
    */
    $config['log_threshold'] = 0;

    Let us know if that helps

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases