Home  >  Article  >  Backend Development  >  YII的CFileLog日志记录格式改写

YII的CFileLog日志记录格式改写

WBOY
WBOYOriginal
2016-06-20 12:33:581032browse

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

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

效果如下:

splunk中格式化如下:

Statement:
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