How to access live debug/log from console? Also how to stop process from console?

When I work on the app from my SSH shell, I use the “mix phx.server” command to get everything running, and it allows me to view the live logs/debug info.

However, sometimes my SSH shell gets disconnected due to an internet connection problem, or me leaving the computer for the day, and I have to log back in again later. The Phoenix app is still running, and when I use “mix phx.server” again, I get an error:

[error] Failed to start Ranch listener ExchatWeb.Endpoint.HTTP in :ranch_tcp:listen([cacerts: :..., key: :..., cert: :..., port: 4000]) for reason :eaddrinuse (address already in use)

Preferably, it would be cool if there was an easy way to just jump right back into the running app and view the live logs without having to kill the process manually and restart (which is what I’ve had to do so far). This is going to be exceptionally important once my app goes live. Is there a way to do this?

Also, what’s the command to stop/kill running Phoenix apps?


I think that for development purposes, using screen or tmux would solve your issues. For production, it’s much better to package your app as a release. Ideally, you’d push your logs to some external service or write them to a file and just tail them once logged into the prod machine.