node.js - Node 层如何管理日志记录
巴扎黑
巴扎黑 2017-04-17 15:15:22
0
3
670

请问在大型的项目中,怎么管理 node 日志记录,因为遇到一个需求 需要把用户操作,包括修改了那些信息等等记录起来,然后展示,log4js 仅仅是日志记录到文件,但是好像不支持日志的查询等操作

巴扎黑
巴扎黑

reply all(3)
Ty80

Can be saved in the database.
Or save it in the log and process it with hadoop

伊谢尔伦

Your requirement is for user operation logs. Just use mysql or other data to store them. log4js is generally used to record system logs

洪涛

If the requirements for log analysis are relatively high, you can use bunyan to write logs. Features:

  • Advantages: The logs are all in json format, and each line is a record, which is very easy to analyze

  • Disadvantages: The logs are in json format and are not for people to see

Based on the above, what you have to do is very simple. Write a simple script, read the log, parse json, and generate reports according to product requirements. As shown in the figure below, analysis is extremely convenient.

Portal: https://github.com/trentm/nod...

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!