I set $config['log_threshold'] = 1; in my production environment to log main errors. I use log_message('error', '....'); to register suspicious behavior in log file.
In my code a have a db->insert. This insert can produce a db error of duplicate key. This is not a problem for me, this can happen and my code check db_error to do the right actions. But every time I get a duplicate key error this is write in my error log and I don't want this. This is not a useful error for my app, so I would like this error is not reported in my log, I want all other errors, my errors (with log_message('error')) but not this error.
I set $db['default']['db_debug'] = FALSE; but nothing changed.
Then I tried to change it dinamically in this way:
$oldvalue = $this->config->item('log_threshold');
$this->config->set_item('log_threshold', 0);
$this->db->insert($this->table, $data);
....
$this->config->set_item('log_threshold', $oldvalue);
but I still see the error in my log file (I read other thread where someone wrote log path can't be dinamically changed, so I think also log_threshold can't be changed dinamically).
I know I can create a transaction, using insert ignore, etc. etc. but I want to know if I can do this with log settings