您的位置:首页 > 编程语言 > PHP开发

php5.4+ CI框架中无法写日志

2017-01-15 22:23 127 查看
最近在使用CI框架时,发现php5.4及其以上版本CI框架不能写日志。

CI框架日志配置:

1.在application/config/config.php中

0=关闭日志
1=错误信息
2=debug信息
3=提示信息
4=所有信息
$config['log_threshold'] = 4;

$config['log_path'] = ''; //日志文件路径,默认路径 application/logs
$config['log_file_extension'] = ''; //日志文件后缀名默认为php
$config['log_file_permissions'] = 0644; //日志文件生成时的权限(linux权限)
$config['log_date_format'] = 'Y-m-d H:i:s'; //日志文件名生成格式


2.使用log_message(level,message) 写日志 ,level类型:error debug info

配置好以后开始写日志,发现浏览器一直在处于刷新等待状态,在默认application/logs下的日志文件发现一行错误

ERROR - 2017-01-15 10:50:53 --> Severity: Warning --> date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. E:\www\citest\system\core\Log.php 176


意思:date()函数是不安全的依赖在系统的时区配置上,你必须使用date.timenoze配置项进行配置或使用date_default_timezone_set()函数进行配置.......

总的意思就是说你没有配置配置php的时区,导致系统核心文件Log.log文件报错

解决:进入php.ini文件找到date.timezone配置项设置值Asia/Shanghai 

date.timezone = "Asia/Shanghai"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: