YII的CFileLog日志记录格式改写

WBOY
Release: 2016-06-20 12:33:58
Original
1005 people have browsed it

yii的文件日志记录格式是一串字符串,在一些日志分析系统中很难进行索引、归类,比如splunk中。典型的yii日志格式如下:

date、level、category、message四个信息混着一起,很难对主要的message进行分析,splunk对json友好,会格式化json成数组,我们把四个属性合在一个json里面,通过对左图的分析,找到关键的formatLogMessage函数,改成右图形式:

效果如下:

splunk中格式化如下:

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!