Logger file backend not working in production

I’m trying to configure logger_file_backend so I can write logs to files in production.

Running Erlang/OTP 22 and Elixir 1.10.3 on Ubuntu 20.04.

Maybe I’m missing some configuration?

This is in prod.exs:

config :logger,
  backends: [{LoggerFileBackend, :info},
             {LoggerFileBackend, :error}]

config :logger, :info,
  path: "/var/log/my_site/info.log",
  level: :info,
  format: "[$date] [$time] [$level] $message\n"

config :logger, :error,
  path: "/var/log/my_site/error.log",
  level: :error,
  format: "[$date] [$time] [$level] $message\n"

Issue was I needed to create the log files, and give them writable permissions.

1 Like