idi527
Failing to remove info level logs from plug and phoenix
![]()
I’ve added
config :logger,
compile_time_purge_matching: [
[application: :phoenix, level_lower_than: :warn],
[application: :plug, level_lower_than: :warn]
]
to my config (dev.exs) and recompiled phoenix and plug with mix deps.compile plug phoenix --force (using dev env) but the info level logs still show up (in dev env).
The global logger log level is set to :debug.
What have I done wrong?
elixir -v
Erlang/OTP 22 [erts-10.4.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.9.0 (compiled with Erlang/OTP 22)
Not specifying level_lower_than seems to work as
config :logger,
compile_time_purge_matching: [
[application: :phoenix],
[application: :plug]
]
removes all logs as seen from the compilation warnings
==> plug
Compiling 1 file (.erl)
Compiling 39 files (.ex)
warning: variable "log" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/plug/session/cookie.ex:131: Plug.Session.COOKIE.decode/3
warning: variable "log" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/plug/session/cookie.ex:158: Plug.Session.COOKIE.decode/3
warning: variable "level" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/plug/logger.ex:26: Plug.Logger.call/2
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/plug/conn/wrapper_error.ex:23
Generated plug app
==> phoenix
Compiling 67 files (.ex)
warning: variable "level" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/phoenix/logger.ex:107: Phoenix.Logger.phoenix_endpoint_start/4
warning: variable "level" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/phoenix/logger.ex:116: Phoenix.Logger.phoenix_endpoint_stop/4
warning: variable "level" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/phoenix/logger.ex:132: Phoenix.Logger.phoenix_error_rendered/4
warning: variable "level" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/phoenix/logger.ex:154: Phoenix.Logger.phoenix_router_dispatch_start/4
warning: variable "level" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/phoenix/logger.ex:182: Phoenix.Logger.phoenix_socket_connected/4
warning: variable "level" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/phoenix/logger.ex:257: Phoenix.Logger.channel_log/3
Generated phoenix app
Most Liked
idi527
Seems like since level is settable for phoenix logger at runtime it’s not purgeable with this option.
My goal was to remove GET / ... Sent in ... logs in :info level and it was possible by setting :log option to :debug for Plug.Logger.
plug Plug.Logger, log: :debug
# and in config
config :logger, level: :info
5
Popular in Questions
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir?
...
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
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
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
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
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
In the Dialyzer docs ( dialyzer — OTP 29.0.2 (dialyzer 6.0.1) ), there is a way to turn off a specific warning for a function:
-dialyzer...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Other popular topics
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
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
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
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
I would like to know what is the best IDE for elixir development?
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









