Welcome Guest, Not a member yet? Register   Sign In
Codeigniter error logging
#1

[eluser]Unknown[/eluser]
I have set error threshold to 1 in config.php.

But the problem is that

Quote:i am getting many errors that is NOT ACTUALLY ERRORS in terms of application logic.

Consider the following code examples

Code:
$deleted = @unlink($filename);
$imap_uid = @imap_uid($con,$msgno);

As you can see that the above example will not throw errors, but codeigniter will log if an error occurred.

Is it possible to disable error logging dynamically ?

i am expecting something like this

Code:
// ....

   $this->error_log = 0; // disable error logging

   //Perform some operation that which may log an error,even its suppressed

   $this->error_log = 1; //enable it again

// ...

Thanks.
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

Code:
$this->config->set_item('log_threshold', 0);

However, you can probably reduce the number of errors you're getting my implementing a helper function that will check to see if the file exists before deleting it. It won't be 100% effective, but it should work very well.
#3

[eluser]TheFuzzy0ne[/eluser]
You could also extend the Log class:

./application/libraries/MY_Log.php
Code:
class MY_Log extends CI_Log {
    
    function enable()
    {
        $this->_enabled = TRUE;
    }
    
    function disable()
    {
        $this->_enabled = FALSE;
    }
}

Untested, but should work. The advantage of this is that you won't need to know what the previous log threshold was in order to re-enable the log class.

Hope this helps.




Theme © iAndrew 2016 - Forum software by © MyBB