quatermain
Phoenix logger format
Hello,
I have this in prod.exs:
config :logger,
level: :info,
backends: [:console],
compile_time_purge_level: :info,
metadata: [:request_id],
format: "$time $metadata[$level] $metadata[$request_id] $message\n"
and I still get this like logger output:
13:55:01.183 [info] GET /sessions/new
13:55:01.185 [info] Sent 200 in 1ms
I use this:
Hex: 0.18.2
Elixir: 1.7.4
OTP: 21.1.1
distillery: 1.5.5
phoenix: 1.4.0
Any idea where can be problem?
First Post!
mudasobwa
Creator of Cure
Most Liked
voughtdq
This happens to me so often and I always forget. Basically, the format is specific to the backend, so you have to add this to your config:
config :logger, :console,
metadata: [:request_id],
format: "$time $metadata[$level] $metadata[$request_id] $message\n"
Edit: and IIRC $metadata is just a list of the metadata variables. So you can’t “access” it. So you’re format probably should be: format: "$time $metadata[$level] $message\n" or you’ll just repeat $metadata twice (and I don’t think $request_id will expand to anything at all)
1
Last Post!
Popular in Questions
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
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
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Other popular topics
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
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
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










