hubertlepicki

hubertlepicki

Logging from Oban workers doesn't seem to work

I am trying to configure logging in Oban in the following way:

  1. I don’t want to be overwhelmed by internal Oban logs. When I set config :oban, log: :warning this happens, but would like to see errors and warnings logged if this happens in Oban internally.
  2. I do want to see logs emitted from the process/1 function 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

sorentwo

Oban Core Team

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.

Where Next?

Popular in Questions Top

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Kagamiiiii
Student & New to elixir. Nice language. I want to convert a english character, e.g. “a”, which is stored in a variable, to it’s asci...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

We're in Beta

About us Mission Statement