VBandarupalli
Phoenix unable to save logs in a file Production env
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
config :logger,
backends: [{LoggerFileBackend, :debug}]
config :logger, :debug,
path: "log/debug.log",
level: :debug
Marked As Solved
hauleth
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.
Also Liked
Exadra37
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.
kokolegorille
Try to find debug.log in your tree, because it might not be where You think it should.
find . -name *.log
or try to use an absolute path… and see if this works.
Eiji
That should be also good:
logs_path = System.get_env("MY_APP_LOGS_PATH")
config :logger, :debug,
path: Path.join(logs_path, "debug.log"),
level: :debug
in config/releases.exs?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









