Managing Log files with distillery

Background

Using distillery to start an OTP App, I noticed that all the logs go to the ./var/log/ folder to 2 different files:

  • erlang.log.1
  • run_erl.log

Problems

I have issues here:

  1. I don’t know what run_erl.log is supposed to log
  2. I would like to change the default log path from ./var/log/erlang.log.1 to ./log/myapp.log

Research

I have checked this discussion for some hints, but according to it I have to change the configurations on the :logger extra app.

Log files in Distillery releases

This search led me to the following code snippet which uses :logger_file_backend

https://snippets.aktagon.com/snippets/773-logging-to-a-file-with-elixir

However I think I am chasing a wild goose here. I don’t think that the solution to my problem lies in adding more dependencies, but rather in changing some configuration for the :logger app.

I just don’t know where nor how.

How can I do it?

1 Like