moonlunatik

moonlunatik

Is it possible to get notice level logs in an Elixir app?

So, my place of employment has some budgetary concerns and due to that, we don’t record historical info level logs, only warning and error ones. I’m developing a feature that would hugely benefit from some logs for debugging but those logs would be more like breadcrumbs and not warnings or errors. After talking to the person responsible for devops he told me they would start recording notice level logs, since that would work for my feature and still exclude a lot of info logs that might not be necessary.

I was pretty happy with this and switched all the relevant logs to notice level, but somehow they weren’t getting picked up by gcc (which is what we use to see logs). After some investigation we found out that it was because the logs were getting translated to info level.

At the moment the Logger docs have this to say about notice level logs:

  • level is one of :debug, :info, :warn, or :error, as previously described (for compatibility with pre 1.10 backends the :notice will be translated to :info and all messages above :error will be translated to :error)

I then found this old topic and I confess that most of the discussion went over my head, but I saw it mentioned that the implementation of :logger was actually s bit newer than elixir’s Logger and from that I got the impression that if perhaps I used :logger directly I could get actual notice logs. Turns out that that is not true, they still get translated to info.

So my question is, is there any way to actually get notice level logs in an Elixir app?

Most Liked

hauleth

hauleth

That should not be true, as the translation happens just before sending them to backends. So if you use Erlang’s handlers, then you should be able to read true level without issues.

al2o3cr

al2o3cr

This appears to be from the docs for custom backends in Logger 1.13.

That mechanism was replaced in 1.15, with new machinery that supports all the Erlang levels.

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
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
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New

We're in Beta

About us Mission Statement