Skip to content
Pedro Belo edited this page Jul 10, 2015 · 16 revisions

Pliny logs basic information from your app automatically, and offers helpers so you get the most out of logging in your app.

You can see what is logged by Pliny by booting your app and making a request to it. The output in your server process should look similar to this:

13:37:43 web.1 | request_id=394dde00-6d0b-48f4-a272-69d403a12d4b instrumentation at=finish method=GET path=/ route_signature=/ status=200 elapsed=0.013

This might read odd for new Pliny developers, but this is just a standard line of log in the logfmt format, which is basically a standard to log data in key/value pairs. And we love logfmt exactly because it's a standard, which means your HTTP request info is going to be logged in the same style as your database performance metrics. You can then use standard tooling and services to parse these logs and build dashboards, alerts and metrics out of them.

It's also worth noticing Pliny apps are configured to log to stdout instead of a file, which we believe provides for a better experience both in development and production.

You can log from anywhere in your app using Pliny.log:

Pliny.log(action: 'login', user: current_user.email)

Which in logfmt results in:

action=login [email protected]

Further reading: