csadewa
Can logger level set per API request?
Hi all, can Logger level set per API request / process?
Suppose there is a buggy API call, and you want to debug what happen during these API call. could you set Logger level to debug for that API request only? maybe via http header / query parameter / other http payload.
I have been looking around Logger module on elixir and :logger application on erlang, but there it doesn’t seem there’s any way to set level on per request process.
Marked As Solved
hauleth
Well, unfortunately not really, at least not without some hacking. There is PR in OTP that would provide such functionality, but it is stalled in discussion:
https://github.com/erlang/otp/pull/2384
Currently the only possible approach is to increase default verbosity and then do manual filtering in front of the filter pipeline, but this can be a little bit problematic approach as it may cause unneeded performance degradation and in case of filter failures, it may DoS the service with logs volume.
Last Post!
csadewa
Yes, you could set Logger options during runtime. However setted Logger options will affect either whole application, or a particular module. both are still global (it affect other request also), as opposed to local/process based. Link given on @hauleth explain a lot on why logger doesn’t have local/process based logging. It also shine light on other options such as tracing debugger / erlang trace module.
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









