请问在大型的项目中,怎么管理 node 日志记录,因为遇到一个需求 需要把用户操作,包括修改了那些信息等等记录起来,然后展示,log4js 仅仅是日志记录到文件,但是好像不支持日志的查询等操作
PHP中文网2017-04-17 15:17:22
Can be saved in the database.
Or save it in the log and process it with hadoop
伊谢尔伦2017-04-17 15:17:22
Your requirement is for user operation logs. Just use mysql or other data to store them. log4js is generally used to record system logs
PHP中文网2017-04-17 15:17:22
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...