multiple times even though if I were to start the application normally (node app.js) it's logged one time?
And it's just a simple console log that says the app has successfully started, but in pm2 logs, there are at least 10 of these
Also it's running in fork mode if it matters
Does the app run normally after this log?
pm2 is process manager AND load balancer
The app works just fine I'm just not sure why it logs the same thing multiple times, and I wasn't able to find anything regarding this issue The only issue I found was on GitHub and it was about the logs being printed two times, not multiple times
To troubleshoot: Run pm2 list to ensure you have only one instance of the application running. Use pm2 logs <app-name> to view the logs and check if the logs are consistently duplicated. Review your ecosystem.config.js or PM2 startup script to ensure no unintended configurations are causing multiple instances or restarts.
Multiple Instances: Ensure that only one instance of the application is running in PM2. Even though you're running in fork mode, if you accidentally started multiple processes, each would generate its own log entries. You can check the number of processes with pm2 list. Application Restart: If your app is set to auto-restart on crashes or if you manually restart it multiple times, this could lead to multiple log entries. Check the restart policy in your ecosystem.config.js or the PM2 command used to start the app.
i also first think it might be multiple instances or this but that doesn't seem to be the case may be this issue is regarding PM2 log rotation or logging configuration on the other thought
Yup There are at least three logs printed to the console I ditched using the pm2.json and just directly launched my app just to see the same thing happening
Обсуждают сегодня