vrod
Hot reloading to add Logging?
I am trying to understand better the Elixir Logger. I have read Compile time purging of logger levels - #12 by aseigo and Logging from within Remote Session - #6 by ityonemo
I have an app where I did something like:
# runtime.exs
config :logger, :console,
level: System.get_env("LOG_LEVEL", "info") |> String.to_existing_atom()
but now I am thinking this is not possible like I hoped. I read about the option for :compile_time_purge_matching… so if I have
config :logger,
backends: [:console],
compile_time_purge_matching: [
[level_lower_than: :info]
]
in my config.exs but I have log level of :debug in runtime.exs, there are no more debug messages visible because they have been removed during compile.
One problem I noticed on a built release is that when I remote attach to a running app, I still see debug messages even when the level is :info. I think this maybe has something to do because my process in remote iex is different that the process of the running app (?) but this is just my guess – I really don’t understand why.
The other example I wanted to see was how to hot reload a module to include logging statements? If I am remote into running app with all debug statements removed at compile time, how could I add debugging back in so I can debug running production instance?
Thank you for your wisdom. I know this is a complex topic but I am trying to get more infos for how to approach.
Popular in Questions
Other popular topics
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









