我需要在codeigniter中创建一个错误日志文件。根据规则,我更改了值$ config ['log_threshold'] = 1;在config.php文件中。错误日志文件已在logs文件夹中创建。但我错误地删除了该文件。我写了这样的编码
$data['name'] = "Somename";
$add_department = $this->db->insert('mas_factory',$data);
if($add_department == false)
{
log_message('error', 'Table field name is wrong.');
}
错误日志文件不会自动生成。但我需要在错误日志文件中看到错误消息。如何创建日志文件。
答案 0 :(得分:3)
使您的/application/log
文件夹可写
在/application/config/config.php
集
$config['log_threshold'] = 1;
使用log_message('error', 'Some variable did not contain a value.');
如果删除了文件,只需重新上传..`