Attaching to existing iex session

I am wondering if I am doing this properly – I made another post about this but I deleted it because maybe it was unclear, so this time I will attempt to make the problem clear.

I am running my app inside iex and there are many log messages. I wish to do some inspections and monitoring of processes and GenStage to see how the progress is going. So I thought I could connect to the running iex session from a different terminal window.

In terminal 1, I start like this: iex --sname conn1 -S mix
In terminal 2, I start like this: iex --sname conn2 --remsh conn1@my-computer -S mix

The problem is that I still see all the log messages in terminal 2, so I still cannot do the inspections.

I am very confused with this and I think I must be doing something wrong. In one simple app, this works ok and the log messages do not appear in terminal 2. But in my regular app, both terminal 1 and terminal 2 show the same firehose of log messages. I have tried removing many things from my app but this still happens.

Thank you for any ideas for how to fix this!

2 Likes

I don’t see that behaviour in my app; the remsh does not output the log statements. What does your config :logger statement look like in this app?

Also I don’t know what the meaning of -S mix would be in Terminal 2; I doubt it hurts anything but it is unnecessary since you are connecting to a process that has already executed mix.

1 Like

Ah! I was very foolish! The -S mix was the problem! Somehow in my app that causes log messages to appear in the other terminal.

The correct way to do this:

In terminal 1: iex --sname conn1 -S mix
In terminal 2: iex --sname conn2 --remsh conn1@my-computer

Thank you!

3 Likes