languages / elixir / integrations / phoenix

Elixir Integrations - Phoenix

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

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

Structured data

You'll Get
event.controller_call
event.template_render

Note: the event.http_request and event.http_response fields are added by the Plug integration.

What you can do with this data

  1. Inspect HTTP requests & their parameters
  2. Inspect Phoenix logs and view their associated metadata
  3. Search on Phoenix structured data
  4. Alert on Phoenix 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 instrumenter:

    1
    2
    3
    # config/config.exs
    config :my_app, MyApp.Endpoint,
      instrumenters: [Timber.Integrations.PhoenixInstrumenter]
    
  2. In your web.ex file, disable the default Phoenix.Controller logging since Timber is now handling this:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    defmodule MyApp.Web do
      #...
      def controller do
        quote do
    -     use Phoenix.Controller
    +     use Phoenix.Controller, log: false
          # ...
        end
      end
      #...
    end
    
  3. In your web.ex file, disable the default Phoenix.Channel logging since Timber is now handling this:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    defmodule MyApp.Web do
      #...
      def channel do
        quote do
    -     use Phoenix.Channel
    +     use Phoenix.Channel, log_join: false, log_handle_in: false
          # ...
        end
      end
      #...
    end
    

Disable

Disabling the Phoenix integration is as simple as skipping or reversing the installation steps above. By skipping installation you'll continue to see Phoenix logs but in the original pre-Timber form. In the rare case that you'd like to disable Phoenix logs entirely, simply follow steps 2 and 3 in the installation section, but skip step 1.

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