Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logger on the disk in Elixir

I am using Elixir's default Logger Module for generating logs. However, I didn't find a way to dump logs on the disk. Is there any such facility in Logger Module? Or is there any other Elixir/Erlang Library which can be used for the same?

like image 777
Kshitij Mittal Avatar asked Oct 07 '15 13:10

Kshitij Mittal


People also ask

What is elixir logger?

A logger for Elixir applications. It includes many features: Provides debug, info, warn, and error levels. Supports multiple backends which are automatically supervised when plugged into Logger . Formats and truncates messages on the client to avoid clogging Logger backends.

What is a Logger backend?

The flash logger backend is used to store logs in non-volatile memory. The backend consists of two logical parts: flashlog and crashlog.

What is logging metadata?

Logging Metadata Logger metadata is a keyword list stored in the process dictionary, so each process has an isolated metadata store. This means that setting metadata in one process won't affect the metadata in another process.


1 Answers

Elixir includes a Logger library. Logger supports different backends where log messages are written to, however at the time being the only built-in backend is :console.

In the Erlang world, one of the well known logging libraries is Lager. In fact, this library was also mentioned last year in a discussion in the elixir-lang-core mailing list.

In the same thread there is also a mention to this project: onkel-dirtus/logger_file_backend. I haven't tried it yet, however it seems to be what you are looking for.

LoggerFileBackend is a custom backend for the elixir :logger application. However, unlike the default :console backend, we may want to configure multiple log files, each with different log levels formats, etc.

like image 104
Simone Carletti Avatar answered Oct 28 '22 13:10

Simone Carletti