Logging Phoenix 1.4 requests to /var/log
shaun.etherton [Today at 8:02 AM]
hello all,
Hoping someone can give me some tips on standard logging for my phoenix app. I’ve been deploying with this line in a simple script. The mix_env is set to prod.
elixir --detached -S mix phx.server > /var/log/phoenix/app.log
1 reply
shaun.etherton [5 minutes ago]
Incase anyone else is stuck on this…
https://github.com/bleacherreport/plug_logger_json
All that was needed was to add the dependency.
[{:logger_file_backend, “~> 0.0.10”}]
and then update the prod.exs config
config :logger,
format: "$message\n",
backends: [{LoggerFileBackend, :log_file}, :console]
config :logger, :log_file,
format: "$message\n",
level: :info,
metadata: [:request_id],
path: "/var/log/phoenix/app.log"
Obviously making sure that the user that runs the elixir command to start the app can write to that directory