csadewa

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

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

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.

Where Next?

Popular in Questions Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

electic
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
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
lanycrost
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
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New