Re: Logging decrease my app performance
Jesper Louis Andersen <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <CAGrdgiV9DE+AeOwVs2QL_K_Vs8oEMj9oawWsST_bJknrLhxCWw@mail.gmail.com> |
On Mon, Nov 16, 2020 at 9:12 AM George Hope <[email protected]> wrote: > what should I do to avoid this performance loss when loglevel is debug? > > Don't log excessively at the debug level. Debug logging is for development, and for enabling in a subsystem when you think something is off. It is quite costly in a fast application, or one which logs a lot. You can often move a lot of debug logging into metrics of the more quantitative kind by using counters, histograms, gauges, ... If you have something odd, use dynamic tracing instead. It tends to be more effective at figuring out what is going wrong in a piece of code. Erlang is an introspective environment where you can dig into a running system. You usually don't need a lot of debug information. Especially not if you treat errors as values in your program. -- J.