leemeichin

leemeichin

Logger changes in Elixir 1.15

By all accounts the documentation says that logging in Elixir is aligning more with Erlang, but the existing approach is soft deprecated.

I haven’t found this to be the case and instead have encountered a breaking change.

Previously, this code was ok:

config :logger,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id, :span_id, :trace_id],
  backends: [LoggerJSON, Sentry.LoggerBackend]

But now it fails because metadata is not supported as an option, and the application does not compile.

The upgrade docs for 1.15 say that things are deprecated, not broken, so I expected that this would continue to compile but with a warning instead.

It’s not clear what the compatible migration path is between all of this, am I missing something?

Most Liked

dbaer

dbaer

I had the same issue when upgrading to 1.15. The app I upgraded originally was built with Phoenix 1.4 and the generator at that time included metadata options in the logger configuration with :request_id, and it had carried through every upgrade until this one.

It was especially nefarious, as it was a hard Erlang beam crash that didn’t indicate what exactly had failed other than Logger. I managed to figure it out after looking at phoenixdiff and noticing that option was removed from the generated config in later versions.

As an aside, I never did look into why this option was used in the first place, and removing it didn’t seem to affect anything I did with Phoenix’s request_id in code. I can’t say the same for your additional :span_id and :trace_id atoms as I haven’t seen them used before.

Where Next?

Popular in Questions Top

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
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
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
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
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
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

Other popular topics Top

AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement