I am trying to save logs into a file.
In dev mode, everything is working fine
When I try these in production nothing seems to be working.
I am using the logger_file_backend package
and configured this in config.exs
Please don’t encourage the use of releases.exs unless the Elixir version is 1.9.* or 1.10.* The file to use from Elixir 1.11.* onward is runtime.exs.
Well, release.exs still have advantages like being able to configure kernel without any additional changes in release configuration.
@VBandarupalli your logs are probably written in your working directory instead of release directory, which isn’t something you would expect. To be honest, I would suggest you to avoid logging to file directly and instead use external logging service like rsyslog or journald to manage files for you. This will also help you in future if you will decide to have centralised logging.
Good to known, but releases.exs may be deprecated in the future.
Also, releases.exs is evaluated at compile time while runtime.exs is evaluated in the machine where the application will run, thus being the correct way of configuring everything you retrieve with environment variables.
IIRC that is not true - both are evaluated during runtime. The main difference is that releases.exs is evaluated, it produces the sys.config, then the whole VM is restarted, while runtime.exs is (by default) evaluated within the same VM the application runs (that is the reason why you cannot configure kernel from runtime.exs by default). However I prefer to avoid both of these files and instead use “raw” sys.config or additional step before the application start for generating such file if needed. Most of the configuration is fetched from the env from within the application itself.