node.js - How does PM2 define that log content has access IP?
世界只因有你2017-05-16 13:45:08
0
2
828
In the nodejs project, the log uses the log function that comes with pm2. I hope that the log content can include the access IP and the log can be divided by day. How to set it up?
If the console prints ip in the project, it will be output to the pm2 log file. Log splitting by day requires configuration
pm2
Parameters.soonfy
pm2实现不了你这功能
,需要配置log4js
to handleThe log function parameters provided by pm2 are as follows
Example
log4js
The npm documentation is very detailed, I’ll just give you some ideasInitialization
log4js
(define file path, segmentation rules)express uses app.user(log4jsInstance.connectLogger, please check the documentation for specific API)
Use pm2 to start express app