Why does Logger output in IEX have to have an empty line after every line logged?

This is a capture of iex running my test app. The Logger.debug output statements all have an empty line after them. Is there a way to fix this? It reduces the amount of log lines I can see on a screen by half.

image

If we’re talking about a Phoenix app, you’ll probably find a line like this in your config: config :logger, :console, format: "[$level] $message\n"

If this is a blank Elixir app, you can add such a line to your config. You can tune the format as you wish.

1 Like

Thanks!

It isn’t a Phoenix app.
But I found the default Logger format is actually:
config :logger, :console, format: "\n$time $metadata[$level] $levelpad$message\n"

from:

So I can just copy it and remove the \n in front.

2 Likes

I can’t for the life of me get this to work, to actually fix the logging output. I can’t be the only one. I’m on Elixir 1.10.2.

Change:

config :logger, :console, format: "\n$time $metadata[$level] $levelpad$message\n"

into:

config :logger, :console, format: "$time $metadata[$level] $levelpad$message\n"

in your config.exs file.

Yep, did that. It isn’t changing the format. I know my config setup is fine, as other items are getting set.

1player Thanks a lot.