Hi Łukasz, Can you please expand what you mean? We already added Logger.put_process_level/2, which applies only to the current process at the moment. So it seems there is a pitfall we may need to document? I believe a process cannot override the general log level, is that correct? In other words, it can only be used to have a more restricted one.
Thanks! On Sat, May 28, 2022 at 12:16 PM luk...@niemier.pl <luk...@niemier.pl> wrote: > There was discussion about that in OTP repository. Unfortunately it is not > possible with current implementation of logger, as you cannot lower the > requirement below default level per process, it is simply not supported by > the OTP logger. > > https://github.com/erlang/otp/pull/2384 > > wtorek, 1 marca 2022 o 13:21:01 UTC+1 Stefan Chrobot napisał(a): > >> On it's way! >> >> Thanks, >> Stefan >> >> wt., 1 mar 2022 o 13:18 José Valim <jose....@dashbit.co> napisał(a): >> >>> Sounds good to me, a PR is welcome! We should actually change >>> Logger.enable to use the new Logger.put_process_level, especially because >>> we have two meta-levels called :none and :all. >>> >>> On Tue, Mar 1, 2022 at 1:11 PM Stefan Chrobot <ste...@chrobot.io> wrote: >>> >>>> Hi, I'd like to propose an addition of put_process_level(pid, level) >>>> into the Logger module to allow controlling the runtime logging level on a >>>> per-process basis. >>>> >>>> Our app runs multiple background processing jobs that are performing >>>> data sync. This means that the jobs run "forever". We're running a job (OTP >>>> process) for each user. While we have metrics and alerts to understand when >>>> a new user is hitting some bumps, we'd like to have detailed logs to help >>>> debug any potential issues. The issues are mostly data-dependent and are >>>> happening in the initial phase of the sync. After that, the issues rarely >>>> ever happen and so the detailed logs are pretty useless, but they still >>>> consume resources. >>>> >>>> We could address our use case with something like the following: >>>> >>>> new? = DateTime.diff(DateTime.utc_now(), sync_start) > @threshold >>>> Logger.put_process_level(self(), if new?, do: :debug, else: :warn) >>>> >>>> The implementation should be pretty straightforward and resemble the >>>> implementation of Logger.enable/1. >>>> >>>> Looking forward to your thoughts. >>>> >>>> >>>> Best, >>>> Stefan >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "elixir-lang-core" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to elixir-lang-co...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/elixir-lang-core/CACzMe7YxiOYc9esU68Db%2Bq7zwfixg2cJyYwb5X2tXdj6V52efw%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/elixir-lang-core/CACzMe7YxiOYc9esU68Db%2Bq7zwfixg2cJyYwb5X2tXdj6V52efw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to elixir-lang-co...@googlegroups.com. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2Bx6e2VvVwiZ-1zuVFX043%3DuXRDRwAA3FQ9n4zyWWArLw%40mail.gmail.com >>> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2Bx6e2VvVwiZ-1zuVFX043%3DuXRDRwAA3FQ9n4zyWWArLw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/c641724d-0e4b-45e6-9452-c042bd556798n%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/c641724d-0e4b-45e6-9452-c042bd556798n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4L%3D8uM0qefVC_JAGRXBXUawKE6gNo456VcBLDHbGGB4TQ%40mail.gmail.com.