Environments

Honeybadger groups errors by the environment they belong to. You don't have to set an environment, but it can be useful if you're running your app in different locations, such as "production" and "staging".

The best way to set the environment is to use Elixir's config_env() function in your config.exs file:

elixir
config :honeybadger, environment_name: config_env()

You can also configure Honeybadger for each of your Mix environments—for example, by adding the following to each of your config/#{env}.exs files in Phoenix:

elixir
# config/dev.exs config :honeybadger, environment_name: :dev # config/test.exs config :honeybadger, environment_name: :test # config/prod.exs config :honeybadger, environment_name: :prod

Tip

Honeybadger's environment_name setting takes precedence over Mix.env().

If environment_name is not set we will fall back to the value of Mix.env(). Mix.env() uses the atomized value of the MIX_ENV environment variable and defaults to :prod when the environment variable is not set. If you want to have an environment_name which is different from Mix.env() (:dev, for example), you should set environment_name in your config.exs as described above. This ensures that we can give you accurate environment information at compile time.

Development Environments

Some environments should usually not report errors at all, such as when you are developing on your local machine or running your test suite (locally or in CI). The honeybadger package has an internal list of environment names which it considers development environments:

dev test

Honeybadger does not report errors in these environments. To send data to all environemtns, you can set the exclude_envs configuration option to an empty list:

elixir
config :honeybadger, exclude_envs: []