问题描述
TP6中输出一条日志
use thinkfacadeLog;
Log.debug('这是一条日志')登录后复制
明明config/log.php 里配置的默认输出就是 file,其他代码使用也正常
在异常处理文件app/ExceptionHandle.php 中使用,想将错误信息输出到文件,方便调试找bug
Log::error($e);登录后复制
直接输出到了输出流,返回给了前端
{code: -1, msg: '错误', data: null}{}登录后复制
导致json解析失败
问题解决
将异常对象转为字符串就可以了
Log::error($e->getTraceAsString());
// 或者指定输出通道
Log::channel('file')->error('一条测试日志');登录后复制以上就是ThinkPHP6.0日志没有输出到文件怎么解决的详细内容,更多请关注php中文网其它相关文章!


parifoot-rdc-793 天前
发表在:laravel 找不到页面Votre guide <a href=...
Anya142Sa10 天前
发表在:ASUS华硕A8N-SLI Deluxe主板BIOS 10110Hello friends! I c...
91资源网站长-冰晨23 天前
发表在:广告合作123
FrankFAT23 天前
发表在:10日14日,星期二,在这里每天60秒读懂世界!Big cocks of blacks ...
RichardGlymn28 天前
发表在:Java webservice多个参数怎么调用https://t.me/win_1_c...
Thomasstolo1 个月前
发表在:Java webservice多个参数怎么调用https://t.me/s/Casin...
Thomasstolo1 个月前
发表在:Java webservice多个参数怎么调用https://t.me/s/Offic...
Thomasstolo1 个月前
发表在:Java webservice多个参数怎么调用https://t.me/s/Offic...
Thomasstolo1 个月前
发表在:Java webservice多个参数怎么调用https://t.me/s/Offic...
Charlesbeise1 个月前
发表在:10日02日,星期四,在这里每天60秒读懂世界!Get free Blockchain ...