languages / elixir / integrations / ecto

Elixir Integrations - Ecto

The Timber for Elixir Phoenix integration structures and enhances your Ecto logs automatically.

  1. Structured data
  2. What you can do
  3. Installation
  4. Configuration
  5. Disable

Structured data

You'll Get
event.sql_query

What you can do

  1. Find slow SQL queries by searching: sql_query.time_ms:>500
  2. View SQL queries in the context of their HTTP request
  3. Inspect SQL queries and view their associated metadata
  4. Alert on Ecto structured data

Installation

⚠ It is highly recommend to use the installer, it will install this integration automatically.

  1. In your config/config.exs file add the Timber Ecto logger:

    1
    2
    3
    # config/config.exs
    config :my_app, MyApp.Repo,
      loggers: [{Timber.Integrations.EctoLogger, :log, []}]
    

Configuration

Please see the Timber.Integrations.EctoLogger docs for advanced configuration options, such as only logging slow queries.

Disable

Disabling the Ecto integration is as simple as skipping or reversing the installation instructions above. In other words, do not provide the :loggers option above. In the rare event that you'd like to disable Ecto logging entirely, set log to false:

1
2
3
# config/config.exs
config :my_app, MyApp.Repo,
  log: false
Questions?

Chat with us, just click the talk button in the bottom right of this page.

Chat with us
Sign Up

Log better and solve problems faster, today. Install in under a minute.

Sign Up