When I run my Elixir app with _build/prod/rel/foo/bin/foo foreground
, the console logging has extra blank lines in it:
16:22:37.911 [info] GET /
16:22:37.911 [info] Sent 200 in 30µs
16:22:37.975 [info] GET /favicon.ico
16:22:37.975 [info] Sent 401 in 30µs
I'm using plug (no Phoenix) with Plug.Logger
; the release was built with distillery. I've not done anything specific to configure logging.
How do I get rid of the blank lines?
You can override the logger format in elixir, which by default contains a newline before and after every line.
Override it by adding this to your config.exs
:
config :logger, :console,
format: "$time $metadata[$level] $levelpad$message\n"
More info about the default logger: https://github.com/elixir-lang/elixir/blob/v1.7.2/lib/logger/lib/logger/formatter.ex
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With