Search code examples
node.jsexpressnginxpm2console.log

How can I access console.log() from node application in ec2 instance


Sample code image

I have a node JS application, using express js as its framework, I integrated some APIs in my application, on my local before pushing to aws, and everything works fine, I get the required data I need from the various endpoints, however when I pushed to AWS, I couldn't get data from the endpoints I integrated, and the application works fine, so I have console.log in strategic places to debug into what could be the issue, unfortunately, I do not know where to view the logs. I use pm2 as the process manager and the application uses a reverse proxy NGINX.

PM2 logs does not give me the logs in the application, for example, console.log(response) in my code, I want to check what the response returns.


Solution

  • you can view your logs on the server terminal, just the same way logs are viewed on the development terminal Better still stop the pm2 process so you can see the response to the console.logs on your terminal, in the server