1

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.

Mukhila Asokan
  • 641
  • 3
  • 11
  • 29
  • http://stackoverflow.com/a/6560739/3164682 – Sarath Sep 01 '15 at 07:06
  • possible duplicate of [How to do error logging in CodeIgniter (PHP)](http://stackoverflow.com/questions/3209807/how-to-do-error-logging-in-codeigniter-php) – Saty Sep 01 '15 at 07:12

1 Answers1

8

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..`

Saty
  • 22,443
  • 7
  • 33
  • 51
Ilanus
  • 6,690
  • 5
  • 13
  • 37