0

Im recently pushing my app to production, however stuff that worked localy dont work on production. Issue is the backend, I'm using node.js and I need to locate the source of the problem. However I don't know how to see my console.logs. Tried using putty, but I don't see anything.

What can I do?

Cœur
  • 37,241
  • 25
  • 195
  • 267
MazMat
  • 1,904
  • 3
  • 12
  • 24
  • you can write logs in file on daily basis – Anshuman Jaiswal Apr 11 '18 at 08:32
  • Possible duplicate of [NodeJS ExpressJS - how to log errors for the production server?](https://stackoverflow.com/questions/43054203/nodejs-expressjs-how-to-log-errors-for-the-production-server) – Zeeshan Hassan Memon Apr 11 '18 at 08:39
  • This is a hard to answer question as it depends almost entirely on your server set up. Some cloud services will have a way to view the console output of node, but in general you may be running it as a background process. The best thing to do is to write logs to a file which you would then be able to read if you ssh to the server (or ftp or whatever you are doing). – Liam MacDonald Apr 11 '18 at 09:48

1 Answers1

1

It depends of the library that you using, if you are using pm2 then type:

pm2 logs

If you using forever type:

 forever describe app

and you will get the file paths for error.log and output.log

Ahmad Zahabi
  • 1,110
  • 12
  • 15
  • Both of these libraries are unrelated to the OP and do not answer the question. – nbokmans Dec 02 '19 at 09:56
  • PM2 is a production process manager for Node.js applications. It allows you to keep applications alive forever. How does this libraries are unrelated to the question?! Most of nodejs applications in production environment uses one of this two libraries. – Ahmad Zahabi Dec 03 '19 at 12:14