Papertrail makes log management easy. It instantly manage logs from many servers.

For intial setup, go through the Getting Started page.

Taking advatage of Elixir logger API, logger_papertrail_backend

  • Add logger_papertrail_backend to your list of dependencies in mix.exs:
1
2
3
def deps do
  [{:logger_papertrail_backend, "~> 0.2.0"}]
end
  • Ensure logger and logger_papertrail_backend is started before your application (pre Elixir 1.4):
1
2
3
def application do
  [applications: [:logger, :logger_papertrail_backend]]
end
  • Or after Elixir 1.4, just ensure Logger is in extra_applications:
1
2
3
def application do
  [extra_applications: [:logger]]
end
  • In your config.exs (or in your #{Mix.env}.exs-files):
1
2
3
4
5
config :logger, :logger_papertrail_backend,
  host: "logs.papertrailapp.com:<port>",
  level: :warn,
  system_name: "Wizard",
  format: "$metadata $message"

Settings up papertrail

1
2
3
4
config :logger, :logger_papertrail_backend,
  url: "papertrail://logs.papertrailapp.com:<port>/<system_name>",
  level: :warn,
  format: "$metadata $message"

Then config :logger to use the LoggerPapertrailBackend.Logger:

1
2
3
4
5
config :logger,
  backends: [ :console,
    LoggerPapertrailBackend.Logger
  ],
  level: :debug