scottmessinger
How to silence Oban during an iex session?
@sorentwo I’m running into an issue where I start an iex session (iex -S mix) and then my terminal keeps showing log messages from Oban:
iex(9)> [info] {"event":"notifier:switch","message":"notifier can't receive messages from any nodes, functionality degraded","source":"oban","status":"isolated"}
[info] {"event":"notifier:switch","message":"notifier only receiving messages from its own node, functionality may be degraded","source":"oban","status":"solitary"}
[info] {"event":"notifier:switch","message":"notifier can't receive messages from any nodes, functionality degraded","source":"oban","status":"isolated"}
[info] {"event":"notifier:switch","message":"notifier only receiving messages from its own node, functionality may be degraded","source":"oban","status":"solitary"}
[info] {"event":"notifier:switch","message":"notifier can't receive messages from any nodes, functionality degraded","source":"oban","status":"isolated"}
[info] {"event":"notifier:switch","message":"notifier only receiving messages from its own node, functionality may be degraded","source":"oban","status":"solitary"}
When I run Application.get_env(:app, Oban), I get:
[
repo: App.PostgresRepo,
engine: Oban.Engines.Basic,
queues: [],
plugins: [],
log: false
]
(I use the Pro Engine but opted for Basic as it seemed like these messages might be related).
Any idea how to quiet the logs so I can use iex without being constantly interrupted by Oban?
Scott
Most Liked
beepbeepbopbop
I suspected these logs are from telemetry events it looks like the case here: oban/lib/oban/telemetry.ex at febfc63d8e7afab62ab9a0da9c782d6374f4a752 · oban-bg/oban · GitHub
You could probably put something in your .iex.exs that disables the logger entirely:
# .iex.exs
:ok = Oban.Telemetry.detach_default_logger()
That ought to work, but you could experiment with different log levels and configure your logger to ignore logs lower than info, while setting Oban’s logger to debug. Alternatively, find where you’re calling attach_default_logger and simply code around it if you’re in a certain MIX_ENV.
sorentwo
Those particular messages are fixed in Oban v2.17.5. You should only see one message, not have it repeat every 15 seconds.
The top level log option is for Ecto logging (the name isn’t very clear). The logs you’re seeing are from Oban.Telemetry.attach_default_logger. The proper way to silence that in iex is with Oban.Telemetry.detach_default_logger(), as noted by @beepbeepbopbop
mayel
Here’s another approach I use to access iex and avoid noise from logs / recompilation messages / etc, with a couple simple cli aliases so that logs appear in the first one but not the extra one:
dev → iex --sname localenv -S mix phx.server
dev-extra → iex --sname extra --remsh localenv
Last Post!
Snake-Sanders
It turns out there are two Oban processes in the umbrella project, thank you for spotting that out. I will read again the documentation.
Cheers
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










