---
title: Breadcrumbs
description: Add breadcrumbs to Elixir error reports to track events leading up to errors and improve debugging.
url: https://docs.honeybadger.io/lib/elixir/errors/breadcrumbs/
---

Breadcrumbs are a useful debugging tool that give you the ability to record contextual data as an event called a `breadcrumb`. When your Project reports an Error (Notice), we send along the breadcrumbs recorded during the execution (request, job, task, etc…).

[Context](https://docs.honeybadger.io/lib/elixir/errors/context/) is another way to store extra data to help with debugging. Context is still a great way to attach global data to an error, however, there are scenarios where Breadcrumbs might be a better choice:

* You want to record metadata that contains duplicate keys
* You want to group related data
* You care about when an event happened in relation to an error

`Honeybadger.add_breadcrumb/2` appends a breadcrumb to the notice. Use this when you want to add some custom data to your breadcrumb trace in effort to help debugging. If a notice is reported to Honeybadger, all breadcrumbs within the execution path will be appended to the notice. You will be able to view the breadcrumb trace in the Honeybadger interface to see what events led up to the notice.

```elixir
Honeybadger.add_breadcrumb("Email sent", metadata: %{
  user: user.id,
  message: message
})
```

Breadcrumbs are stored per process. If you send messages between processes, breadcrumbs do not transfer automatically. Each breadcrumb uses memory, so be conservative when you add them in systems with many processes.

## Automatic breadcrumbs

Honeybadger uses `telemetry` to create breadcrumbs from these events automatically:

* **Phoenix**: A breadcrumb for each router dispatch (Phoenix >= 1.4.7).
* **Ecto**: A breadcrumb for each SQL query (`ecto_sql` >= 3.1.0). List the repos to instrument in your config:

```elixir
config :honeybadger,
  ecto_repos: [MyApp.Repo]
```

## Disabling breadcrumbs

Breadcrumbs are enabled by default. To turn them off:

```elixir
config :honeybadger,
  breadcrumbs_enabled: false
```

---

## Try Honeybadger for FREE

Intelligent logging, error tracking, and Just Enough APM™ in one dev-friendly platform. Find and fix problems before users notice.

[Start free trial](https://app.honeybadger.io/users/sign_up)

[See plans and pricing](https://www.honeybadger.io/plans/)
