languages / elixir / installation / manual

Elixir Installation - Manual

⚠ We highly recommend using the Elixir installer to get Timber setup in your Elixir application. If that is not possible, please follow the instructions below.


This document assumes a basic understanding of how Elixir application logs flow from an application to a service using STDOUT, HTTP, or a file. To get started, please follow the steps below:

  1. Grab a coffee. Elixir is welcomely explicit (we love Elixir and use it internally at Timber), so the manual installation procees requires more steps.

  2. In your Mix.exs file, add the timber dependency:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    # Mix.exs
    
    def application do
      [applications: [:timber]]
    end
    
    def deps do
      [{:timber, "~> 2.5"}]
    end
    
  3. In your shell, run:

    1
    mix deps.get
    
  4. Setup the base Timber logger configuration by choosing the appropriate delivery method. If you are unsure, please read our HTTP, STDOUT, or log files? guide:

    • To send your logs over HTTP (recommended and simplest), add the following in your config/config.exs file:

      1
      2
      3
      4
      5
      6
      7
      # config/config.exs
      config :logger,
        backends: [Timber.LoggerBackends.HTTP],
        utc_log: true
      
      config :timber,
        api_key: "{{my-timber-api-key}}"
      
    • To send your logs to STDOUT (you'll need to integrate with the appropriate platform), all the following in your config/config.exs file:

      1
      2
      3
      4
      5
      6
      7
      8
      # config/config.exs
      config :logger,
        backends: [:console],
        utc_log: true
      
      config :logger, :console,
        format: {Timber.Formatter, :format},
        metadata: [:timber_context, :event, :application, :file, :function, :line, :module, :meta]
      
  5. Install the Timber.Integrations, skip any that you application does not use:

    1. Phoenix integration
    2. Plug integration
    3. Ecto integration
  6. All done! Be sure to commit these changes and deploy.

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