pm2 自定义log, pid 等日志文件位置
方法一:
直接引用 pm2官方的:
http://pm2.keymetrics.io/docs/usage/log-management/
Log configuration
CLI
Example:
1 | $ pm2 start echo.js --merge-logs --log-date-format="YYYY-MM-DD HH:mm Z" |
Options:
1 | --merge-logs do not postfix log file with process id |
JSON way
1 | { |
Combine out and err logs
To combine all logs into the same file set the same value for error_file, out_file or use an additional log_file.
For example, this keeps out and err separated but adds a combined file:
1 | { |
Or if you want out and err combined without any other file, just use the same log file:
1 | { |
Note that relatives logs paths will usually be written in the PM2_HOME (~/.pm2/logs) .
方法二:
修改 ~/.pm2 目录下的 conf.js
1 | //conf.js |
修改完之后还不是立即生效.
执行一下 pm2 kill 来 杀掉 pm2 然后 执行 pm2 start 你的配置 来使修改生效.
感谢您的阅读,本文由 smallwhite's Blog 版权所有。如若转载,请注明出处:smallwhite's Blog(https://smallwhite.ml/pub/uncategorized/pm2-zi-ding-yi-log-pid-deng-ri-zhi-wen-jian-wei-zhi.html)