Using distillery to start an OTP App, I noticed that all the logs go to the ./var/log/
folder to 2 different files:
I have issues here:
run_erl.log
is supposed to log./var/log/erlang.log.1
to ./log/myapp.log
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 start
to start your application? In that case perhaps RUNNER_LOG_DIR
is 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_DIR
is mentioned during the discussion.
distillery
, in turn, lists RUNNER_LOG_DIR
as a configurable environment variable. It is then used when starting your application here.
I don’t know what
run_erl.log
is supposed to log.
Per official Erlang documentation, run_erl.log
is used to log progress and warnings from the run_erl
program itself. run_erl
is a program that starts the application.
I would like to change the default log path from
./var/log/erlang.log.1
to./log/myapp.log
.
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 symlinking myapp.log
and erlang.log.1
.