Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

log file in Codeigniter

I need to create a error log file in codeigniter. As per the rules i changed the value $config['log_threshold'] = 1; in config.php file. Error log file was created in the logs folder. But i wrongly deleted that file. I wrote the coding like this

 $data['name'] = "Somename";
 $add_department = $this->db->insert('mas_factory',$data);
 if($add_department == false)
 { 
     log_message('error', 'Table field name is wrong.');    
 }

error log file is not automatically generated. But i need to see the error messages in error log file. How to create a log file.

like image 267
Mukhila Asokan Avatar asked Aug 29 '26 15:08

Mukhila Asokan


1 Answers

Make your /application/logs folder writable

In /application/config/config.php set

$config['log_threshold'] = 1;

Use log_message('error', 'Some variable did not contain a value.');

If you deleted the file simply re upload..`

like image 154
Ilanus Avatar answered Aug 31 '26 08:08

Ilanus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!