Getting log entries to a new line when logging to a file

I’ve been trying to use the new Logger updates in 1.15 but I’ve found that when I log to a file it’s creating a single continuous string rather than adding new entries to a new line.

I’m using a standard config copied from the docs:

config :logger, :default_handler,
  level: :info,
  config: [
    file: ~c"system.log",
    filesync_repeat_interval: 5000,
    file_check: 5000,
    max_no_bytes: 10_000_000,
    max_no_files: 10,
    compress_on_rotate: true

config :logger, :default_formatter, format: "$time $metadata[$level] $message $metadata"

The file it creates is basically unusable as a log but I can’t see which bit of config I might be missing. Any ideas?

Change the config to

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

Hah, thanks!


/in Dwayne Johnson’s voice/ You’re welcome.

1 Like