jschniper / gelf_logger

An Elixir Logger backend for GELF
MIT License
29 stars 27 forks source link

cannot produce logs when rpc-ing into a elixir release #23

Open flavius-gemini opened 4 years ago

flavius-gemini commented 4 years ago

When u use rpc to connect to a running elixir process and then execute any action that would cause a log to be sent to gelf, the messages are not sent. Steps to reproduce 1.Build a long living app called hello_world. Say a api based on phoenix. 2.mix release. 3.start your app with /bin/hello_world daemon (or start) 4.from another console, you go /bin hello_world rpc "require Logger; Logger.info(\"flavius was here\")" Expected result flavius was here is logged to gelf Actual result flavius was here is not logged to gelf

The fix is easy and it is suggested at the end of this thread. https://elixirforum.com/t/logging-from-within-remote-session/26323/5

Mainly just delete the handle_event at line 71.

jschniper commented 4 years ago

Sorry for the very slow response. What the code is doing currently is in line with what is recommended in https://hexdocs.pm/logger/Logger.html#module-custom-backends

I'm trying to dig in and find why that is recommended.

jschniper commented 4 years ago

Looks as though removing it can create up some situations where events are double logged but I need to play around with it some more in order to tell if it's something that would ever happen in normal usage.