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:
- I don’t know what
run_erl.logis supposed to log - I would like to change the default log path from
./var/log/erlang.log.1to./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?
Are you using
bin/your_app startto start your application? In that case perhapsRUNNER_LOG_DIRis a variable you're looking for to customize the log output directory.I did a small research and noticed the issue "how to configure the path of the run_erl (for erlang.log.X, run_erl.log files)" that is similar to yours.
RUNNER_LOG_DIRis mentioned during the discussion.distillery, in turn, listsRUNNER_LOG_DIRas a configurable environment variable. It is then used when starting your application here.Per official Erlang documentation,
run_erl.logis used to log progress and warnings from therun_erlprogram itself.run_erlis a program that starts the application.Per my findings it should be possible to change the location of the log files, but I'm yet to see if it is possible to change the name of the file too (
erlang.log.1 -> myapp.log), if that's also what you are asking. If you really need to change the name of the file, I'd look into symlinkingmyapp.loganderlang.log.1.