PatrickSachs
Hello there!
I am currently facing an issue with the logger.
At some point it started logging at info level only despite being configured to log at debug level. The interesting thing is that it used to work fine before. I am not sure what broke it, since I wasn’t working on the project for over a month. So it may have been a breaking Elixir update or a lack of knowledge by making a bad change on my part.
This is my elixir version:
patrick@PATRICK:~$ elixir -v
Erlang/OTP 22 [erts-10.6.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Elixir 1.9.4 (compiled with Erlang/OTP 21)
This is my logger configuration:
config :logger,
level: :debug
config :logger, :console,
metadata: :all,
level: :debug,
format: {Sahnee.Logger, :format}
(The formater is not related to this, removing the custom formater yielded the same result)
If I launch my application with iex -S mix the logger is configured to level info:
iex(2)> require Logger
Logger
iex(3)> Logger.level
:info
iex(4)> Logger.debug("debug")
:ok
iex(5)> Logger.info("info")
:ok
15:49:45-875 [info] #PID<0.1106.0>@.:5
info
iex(6)> Logger.configure(level: :debug)
:ok
iex(7)> Logger.debug("debug2")
:ok
15:49:56-202 [debug] #PID<0.1106.0>@.:7
debug2
Can anyone point out why this is happening? No calls to Logger.configure are made in the application code.
Thank you for your time!
Patrick
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
Are you using correct
MIX_ENV?PatrickSachs
I am not setting it explictly, just running
iex -S mix. Should I be doing this? If so, where and how?Checking the env tells me that its in
devmode: (which is what I want, I am on my development machine)NobbZ
In which file is your logger config? And is that file actually loaded from your
config.exs.PatrickSachs
My config is in a file called
sys.exs. This file is loaded in the first line of myconfig.exs. The file also contains several other options (such as the Ecto Repo, etc.) which are working.Interestingly enough, all values other than the log level are also loaded:
There also do not seem to be any other places where this config value is changed:
ityonemo
What happens if you switch from use Mix.Config to import Config?
PatrickSachs
Same result, all config values except this single one are applied:
config.exs:
sys.exs:
hauleth
What is in
# Snipparts? Are you sure that you do not set that key to different value later?PatrickSachs
Unfortunately not, no. I posted a screenshort earlier where I searched for
:loggerin my entire project. The term has only three occurences: Two for the two config entries posted above and one inextra_applicationto actually start the logger (I think, been a while since I set it up).If you absolutely want to see the full config I can post it, but since its roghly 150 lines I’d prefer to spare you the wall of text. (Also worried about forgetting to remove a production secret :D)
hauleth
Just use paste bin. However it is hard to tell you where the bug can be. Unfortunately
loggerisn’t external application so it isn’t that simple to edit it.Try searching for
Logger, maybe there is some rouge call that changes it in the application itself.PatrickSachs
:loggernorLoggerare used or configured within this file.)Which terms would be of interest to search? It’s a large application (by my standards) so there are hundrets of Logger calls.
Logger.configureis not called. Asides from normal log statements a lot of metadata is being set, but no metadata entry is calledlevelor contains the valueinfoif that could be a culprit.Thanks to everyone who has posted so far. This is probably going to be an embarassing “oops” kind of mistake that I made, but the source of it eludes me.