Welcome Guest, Not a member yet? Register   Sign In
log_threshold or ENVIRONMENT
#1

What is the difference between index.php ENVIRONMENT and $config['log_threshold'] = 2; in config.php?

Is it best practice to put this in config.php?
PHP Code:
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines 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
|
| You can also pass an array with threshold levels to show individual error types
|
|     array(2) = Debug Messages, without Error 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'] = '';
switch (ENVIRONMENT)
{
    case 
'development':
        
$config['log_threshold'] = 2;
    break;

    case 
'testing':
    case 
'production':
        
$config['log_threshold'] = 1;
    break;

    default:
        
$config['log_threshold'] = 0;

Why does error_reporting setting exist in two separate places?
Reply
#2

You'll rarely need the logging feature turned on, even in your development environment. There are better ways to log. ChromePhp or FirePhp are great for console logging from the server. FirePhp currently only works with older versions of Firefox, but it's pretty easy to install multiple versions of Firefox. I use Firefox v48.
Reply
#3

(10-08-2017, 05:52 PM)meow Wrote: What is the difference between index.php ENVIRONMENT and $config['log_threshold'] = 2; in config.php?

Why does error_reporting setting exist in two separate places?

The logic checking ENVIRONMENT is used to set PHP error reporting while $config['log_threshold'] is used to determine what amount of detail gets added to the application logs that CI generates.

CI does catch and log many PHP related warnings and errors - but not all of them. In particular, third-party software (i.e. discussion forum) running on a site might be totally unaware of the CI framework.

In short there are two separate but somewhat overlapping systems for reporting info, warnings and errors.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB