Why we need this ?
There are a lot of reasons to do this thing but mainly we can use this thing to simplify our development process. It is good if front-end developers also see what is happening behind the scenes.
Suppose you have a dev server and there are an API server running on it. Developers are accessing that API server for building Web or Mobile Applications. Sometimes while building the application, due to some false data, the API server get crashed and returns
502. In that case if you have direct server logs, you can see the cause of the error and fix that issue.
— There will be one server which will broadcast logs over particular host and one client listening for logs.
- NodeJS App ( Demo App)
- PM2 — Process Manager for NodeJS Apps
- Run your NodeJS application and pipe
rtailwith it. i.e
node app.js | rtail --id api --host 127.0.0.1 --port 9999
2. Add this as start script in your
"start": "node app.js | rtail --id api --host 127.0.0.1 --port 9999"
3. Use PM2 to run your application as a process.
pm2 start npm -- start
rtail-server which will work as a reciever
rtail-server --web-version stable
⚠️ You can run
rtail-serveras a process also using PM2. Execute :
pm2 start rtail-server.
http://localhost:8888 and you will get a screen like this
If you like this article, please give it some claps 👏 and share it! If you do not like this post or have any type of questions regarding anything that i mentioned in this post. Feel free to ask me. Just post an issue in my “Ask Me Anything” by clicking here.