Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 533765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:32:32+00:00 2026-05-13T09:32:32+00:00

In my CI config file I have this logging treshold set: $config[‘log_threshold’] = 1;

  • 0

In my CI config file I have this logging treshold set:

$config['log_threshold'] = 1;

In index.php, I have set the following error reporting:

error_reporting(E_ERROR);

My expectation is that this will log any CI errors that I log (using log_message('error','my error message')), as well as any PHP errors. However, I would expect that it will not log PHP notices, only errors. However, when I look at the log files, it seems to log PHP notices too:

ERROR – 2009-12-18 13:21:50—> Severity: Notice —> Undefined variable: pageindex /var/www/apps/OS4W/system/application/views/user/view.php 12
ERROR – 2009-12-18 13:21:50—> Severity: Notice —> Undefined variable: friendsmode /var/www/apps/OS4W/system/application/views/user/activitytable.php 207

Although the log lines start with “ERROR”, in reality this seems to be a PHP notice, kind of like a warning, that I do not want to log. How can I make sure only CI and PHP errors are logged, yet not PHP notices? I thought error_reporting(E_ERROR) would do just that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:32:33+00:00Added an answer on May 13, 2026 at 9:32 am

    First of all, thank you all for thinking along. After considering your advise, I decided to patch the core of CI. Unfortunately, the core classes can be extended, but not the core itself. Therefore if you apply the same patch, be sure to document it.

    Here goes. In system\application\config\config.php I added the following custom config setting right below the log_treshold setting:

    /*
    |--------------------------------------------------------------------------
    | Error Logging Exclusions (custom config addition by Ferdy Christant)
    |--------------------------------------------------------------------------
    |
    | By default, CI will log all PHP errors, whether it is a notice, warning
    | or error. Or, by setting the above treshold to 0, it will log nothing
    | In most cases, however, you will want to log PHP errors but not the notices
    | In the array below, simply place the PHP error constant that you do NOT
    | want to see logged. 
    |
    | For a live site you'll usually use the config as follow:
    |
    | $config['exclude_logging'] = array(E_STRICT,E_NOTICE);
    |
    */
    
    $config['exclude_logging'] = array(E_STRICT,E_NOTICE);
    

    As the documentation explains, in this config array you put the PHP error types that you do NOT want to log.

    Next, I have patched the core file (system/codeigniter/Common.php) and edited the function _exception_handler

    There are two changes. First, I moved the config loading line to the top of the method, since I need it earlier. Find the line below and you will see $config =& get_config(); under it. Delete that.

    I removed the // Should we log the error? No? We’re done…

    Second, the check for severity is modified to check for the array that we declared. Go to the top of the method and replace the if statement that checks $severity == E_STRICT with below:

    $config =& get_config();
    if (in_array($severity,$config['exclude_logging']))
    {
    return;
    }
    

    These patches allow for fine-grained control over PHP error logging. Normal CI logging will of course still work. As mentioned, the only downside is that this patches the core.

    I hope this helps anyone. Thank you for thinking along!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.