'Ubuntu where to see console.logs
So I am putting my app on a server and I want to see some console logs generated from my nodejs app. Before putting it on the server I saw the output of my console log on my terminal, but where do I find the output for these on Ubuntu? I'm running version 16.04 on Ubuntu
Solution 1:[1]
Lifted straight from @SlovyanskiyYehor comment two years ago, but I missed his answer as a comment. Also answered here: Make pm2 log to console.
If you are using pm2 to start your node.js application, you can use:
pm2 logs
or for just a single app running in pm2:
pm2 logs yourAppNameHere
Solution 2:[2]
If you are using some bash script which is runed by cron for example, you can specify file where you need to output all logs of your app It will looks like that:
myApp > /path/to/logs/myAppLogs.txt
This command will run application myApp and put all logs into "/path/to/logs/myAppLogs.txt"
Also you can put this string into cron directly without some bash scripts
Of course you can see all console logs by user here ~/.bash_history but it`s not always useful
Solution 3:[3]
If you used pm2, you can check log in this folder:
/root/.pm2/log
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | SlovyanskiyYehor |
Solution 3 | MrXo |