Missing log entries Logger

Hi everyone,
I’ve an application in production- I noticed from time to time there’s a missing log entry when I check the log files. I’m not sure what the issue could be. Thanks.

Which Elixir version? Could you provide more information? What log messages are missing, what is your logger configuration?

  1. Elixir v1.9.2
  2. Logger configuration in config/config.exs -

config :logger, :console,
format: “$date $time $metadata[$level] $message\n”,
metadata: [:request_id]

  1. config/releases.exs

config :logger, level: :info

I log api calls and database operations like inserting and updating.

I think that the log messages are being discarded.
I’ve peruse the log files but can’t find any log to indicate that messages are being discarded.
Any assistance will be most welcomed.

Hello @kodepett, have you identified the root cause of this issue? We are experiencing a similar situation when multiple processes start logging concurrently.

When the logger message queue is overloaded, for the logger to remain performant, beyond a certain configurable threshold, it discards new messages. The logger also alternate between synchronous and asynchronous mode when overloaded.

Discarding of messages was quite a bitter pill to swallow as it happened in production but lessons were learnt; for stateful applications (applications that maintain states), though you add them as libraries, interacting with them involves message passing.

Please peruse the below link, elixir logger is now an abstraction over erlang logger or should I say it integrates with the erlang logger.

Erlang Logger user guide

The logger now does a lot of work in the client context and so it should be very performant compared to it predecessor before otp 21, you can read this articles by @ferd Erlang Logger “My bad opinions”. @ferd talks about the new logger architecture and performance gains vis-a-vis design.

Sincere apologies for the late reply.

2 Likes