CodeIgniter 3 - configuring log_threshold

2019-09-02 10:17发布

问题:

Ok I got confused.

Inside application/config.php it says in comments:

    | If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| 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

So if I want to get Error and Debug messages and not any Information messages, do I have to set the threshold

$config['log_threshold'] = 2;

or

$config['log_threshold'] = array(1, 2);

Could someone give me some clarification?

回答1:

Both would work, simply because informational messages has a value of 3, while the maximum one that you want is 2.

However, if you wanted to log informational and error messages, but no debug messages, you'd have to set a value of array(1, 3) in order to skip the debug ones.