如何做错误日志记录在CodeIgniter(PHP) [英] How to do error logging in CodeIgniter (PHP)
本文介绍了如何做错误日志记录在CodeIgniter(PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在PHP CodeIgniter中记录错误。如何启用错误日志记录?
I want error logging in PHP CodeIgniter. How do I enable error logging?
我有一些问题:
- 如何将错误消息推送到日志文件中(每当发生错误时)
<
推荐答案
CodeIgniter内建了一些错误记录功能。
CodeIgniter has some error logging functions built in.
- 建立您的 / application / logs 可写入
- 在 /application/config/config.php 中设置
$ config ['log_threshold'] = 1; code>
或使用更高的数字,具体取决于您的日志中需要多少详细信息。 - 使用
log_message('error'变量不包含值。');
- 要发送电子邮件,您需要扩展核心CI_Exceptions类方法
log_exceptions
。您可以自己执行此操作,也可以使用此。有关扩展核心的详情,请参阅此处
- Make your /application/logs folder writable
- In /application/config/config.php set
$config['log_threshold'] = 1;
or use a higher number, depending on how much detail you want in your logs - Use
log_message('error', 'Some variable did not contain a value.');
- To send an email you need to extend the core CI_Exceptions class method
log_exceptions()
. You can do this yourself or use this. More info on extending the core here
请参阅 http:// www .codeigniter.com / user_guide / general / errors.html
这篇关于如何做错误日志记录在CodeIgniter(PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文