hubertlepicki
Logging from Oban workers doesn't seem to work
I am trying to configure logging in Oban in the following way:
- I don’t want to be overwhelmed by internal Oban logs. When I set
config :oban, log: :warningthis happens, but would like to see errors and warnings logged if this happens in Oban internally. - I do want to see logs emitted from the
process/1function in all of my workers.
I can’t seem to be able to configure it this way, in fact all log messages emitted from my workers seem to be swallowed/disappear, if I set the logging level to :warning on Oban config, and it outputs a bunch of debugging log statements like Ecto queries done with status: warning instead.
What is the correct configuration in that case? I want to see important internal events from Oban and my logs I emit from worker.
The logs I emit from worker manually are properly logged out when I don’t specify log: :warning to Oban config.
Marked As Solved
sorentwo
The log option is purely for ecto logging, for historic reasons. To get job, plugin, and other important logging you need to attach the telemetry logger manually:
Oban.Telemetry.attach_default_logger()
The goal for Oban v3.0 is to attach a logger by default, and control the levels/options with the log option, and set the ecto/repo log level separately.
There has always been documentation on the Oban.Telemetry module about the logger, since it was introduced in Oban v0.4. However, you’re right that it wasn’t included as part of the installation/getting started guides until fairly recently.








