---
title: Java agent error collector settings
source: https://docs.newrelic.com/docs/apm/agents/java-agent/configuration/java-agent-configuration-error-collector-settings
---

Error collector settings control how the agent captures, filters, and reports errors and exceptions.

> #### 💡 TIP
>
> Back to the full settings index: [Java agent configuration](https://docs.newrelic.com/docs/apm/agents/java-agent/configuration/java-agent-configuration-config-file)

## Error collector [#Error_Collector]

Set the error collector settings in the `error_collector` section. Unless otherwise noted, you can [override](#System_Properties) these settings with a `newrelic.config.error_collector` prefixed system property. The error collector captures information about uncaught exceptions and sends them to New Relic for viewing.

> #### 💡 TIP
>
> For how to configure errors for the Java agent, including how to configure errors via the UI, see [Java agent error configuration](https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-error-configuration).

**enabled**

| Type    | Boolean |
| ------- | ------- |
| Default | `true`  |

Enable error collection.

**ignore_classes**

| Type    | Section containing a list of fully qualified `class_name` strings |
| ------- | ----------------------------------------------------------------- |
| Default | (none)                                                            |

Specified exception class names will be ignored and will not affect error rate or Apdex score, or be reported to APM. **Cannot be specified by system property.**

This setting is dynamic, so running agents will notice changes to `newrelic.yml` without a JVM restart.

For example:

````yml
error_collector:
  ignore_classes:
    - "com.example.MyException"
    - "com.example.DifferentException"
```

An environment variable can be used to list exception class names you want to be ignored:

```ini
NEW_RELIC_ERROR_COLLECTOR_IGNORE_CLASSES="[\"com.example.MyException\", \"com.example.DifferentException\"]"
```

````

**ignore_messages**

| Type    | Section containing a fully qualified `class_name` and a list of `messages` per error class |
| ------- | ------------------------------------------------------------------------------------------ |
| Default | (none)                                                                                     |

Specify exception class names the agent should ignore. Ignored messages will not affect error rate or Apdex score, or be reported to APM. Contains `yaml` pairs consisting of:

-   A fully qualified exception class name that should not be reported to APM

    AND
-   A list of exception `message`s to match against (at least one is required)

    If the exception class name matches an error but the message does not, then that error **will not** be ignored. Message strings use `contains` for matching. A message cannot be provided on its own and must always be paired with a fully qualified class name. **Cannot be specified by system property.**

    This setting is dynamic, so running agents will notice changes to `newrelic.yml` without a JVM restart.

    For example:

    ```yml
    error_collector:
      ignore_messages:
        com.example.MyException:
          - "Some error message to ignore"
          - "Some other error message to ignore"
        com.example.DifferentException:
          - "Some different error message to ignore"
    ```

    An environment variable can be used to list exception class names and messages you want to be ignored:

    ```ini
    NEW_RELIC_ERROR_COLLECTOR_IGNORE_MESSAGES="{\"com.example.MyException\": [\"Some error message to ignore\", \"Some other error message to ignore\"], \"com.example.DifferentException\": [\"Some different error message to ignore\"]}"
    ```

**ignore_status_codes**

| Type    | Comma-separated list of strings and ranges |
| ------- | ------------------------------------------ |
| Default | `404`                                      |

A comma-separated list comprised of individual and dashed ranges of HTTP status codes that should not be treated as errors.

If this property is commented out in the `newrelic.yml` configuration file, then the 404 status code will automatically be ignored. When using [server-side configuration](https://docs.newrelic.com/docs/agents/manage-apm-agents/configuration/server-side-agent-configuration), the status code 404 must be specified in order for it to be ignored.

This setting is dynamic, so running agents will notice changes to `newrelic.yml` without a JVM restart.

For example:

````yml
error_collector:
  ignore_status_codes: 404,507-511
```

````

**expected_classes**

| Type    | Section containing a List of fully qualified `class_name` strings |
| ------- | ----------------------------------------------------------------- |
| Default | (none)                                                            |

Prevents specified exception classes from affecting error rate or Apdex score while still reporting the errors to APM. **Cannot be specified by system property.**

This setting is dynamic, so running agents will notice changes to `newrelic.yml` without a JVM restart.

For example:

````yml
error_collector:
  expected_classes:
    - "com.example.MyException"
    - "com.example.DifferentException"
```

An environment variable can be used to list expected exception class names:

```ini
NEW_RELIC_ERROR_COLLECTOR_EXPECTED_CLASSES="[\"com.example.MyException\", \"com.example.DifferentException\"]"
```

````

**expected_messages**

| Type    | Section containing a fully qualified `class_name` and a List of `messages` per error class |
| ------- | ------------------------------------------------------------------------------------------ |
| Default | (none)                                                                                     |

Contains yaml pairs consisting of a fully qualified exception class name that should be marked as expected and thus prevented from affecting error rate or Apdex score and a List of exception `message`s to match against, the latter of which at least one is required. If the exception class name matches an error but the message does not, then that error **will not** be marked as expected and therefore will affect error rate and Apdex score.

Message strings use `contains` for matching. A message cannot be provided on its own and must always be paired with a fully qualified class name. **Cannot be specified by system property.**

This setting is dynamic, so running agents will notice changes to `newrelic.yml` without a JVM restart.

For example:

````yml
error_collector:
  expected_messages:
    com.example.MyException:
      - "Some expected error message"
      - "Some other expected error message"
    com.example.DifferentException:
      - "Some different expected error message"
```

An environment variable can be used to list expected exception class names and messages:

```ini
NEW_RELIC_ERROR_COLLECTOR_EXPECTED_MESSAGES="{\"com.example.MyException\": [\"Some error message to ignore\", \"Some other error message to ignore\"], \"com.example.DifferentException\": [\"Some different error message to ignore\"]}"
```

````

**expected_status_codes**

| Type    | Comma-separated list of strings and ranges |
| ------- | ------------------------------------------ |
| Default | (none)                                     |

A comma-separated list comprised of individual and dashed ranges of HTTP status codes to be marked as expected and thus prevented from affecting error rate or Apdex score.

This setting is dynamic, so running agents will notice changes to `newrelic.yml` without a JVM restart.

For example:

````yml
error_collector:
  expected_status_codes: 415,500-506
```

Expected status codes can also be with the `NEW_RELIC_ERROR_COLLECTOR_EXPECTED_STATUS_CODES` environment variable.

````

**attributes.enabled**

| Type    | Boolean |
| ------- | ------- |
| Default | `true`  |

This setting can be used to turn on or off all attributes for traced errors. If `attributes.enabled` is `false` at the root level, then no attributes will be sent to traced errors regardless of how this property is set under `error_collector`.

**attributes.include**

| Type    | List of strings |
| ------- | --------------- |
| Default | (none)          |

If attributes are enabled for traced errors, all attribute keys found in this list will be sent to New Relic in traced errors. For more information, see the [agent attribute rules](https://docs.newrelic.com/docs/apm/other-features/attributes/agent-attributes).

**attributes.exclude**

| Type    | List of strings |
| ------- | --------------- |
| Default | (none)          |

Attribute keys found in this list will not be sent to New Relic in traced errors. For more information, see the [agent attribute rules](https://docs.newrelic.com/docs/apm/other-features/attributes/agent-attributes).

**ignoreErrorPriority**

| Type    | Boolean |
| ------- | ------- |
| Default | `true`  |

When multiple errors are noticed in a transaction, only the last error will be reported by default. Setting this property to `false` will instead report only the first error that is noticed. For more information, see the [noticeError API](https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-error-configuration/).
For example:

````yml
error_collector:
  ignoreErrorPriority: false
```

````

**ignore_errors (DEPRECATED)**

| Type    | Comma-separated list of Strings |
| ------- | ------------------------------- |
| Default | (none)                          |

All specified exception class names specified will not be treated as errors. Deprecated as of Java agent 3.40.0 and replaced by [`ignore_classes`](#ec-ignore_classes).

For example:

````yml
error_collector:
  ignore_errors: some.other.MyException
```

````

## Errors inbox configuration [#errors-inbox-configuration]

Setting one of the following tags will help you identify which versions of your software are producing the errors.

-   `NEW_RELIC_METADATA_SERVICE_VERSION` will create `tags.service.version` on event data containing the version of your code that is deployed, in many cases a semantic version such as 1.2.3, but not always.
-   `NEW_RELIC_METADATA_RELEASE_TAG ` will create `tags.releaseTag` on event data containing the release tag (such as v0.1.209 or release-209).
-   `NEW_RELIC_METADATA_COMMIT` will create `tags.commit` on event data containing the commit sha. You can use the entire sha or use just the first seven characters (e.g., 734713b).

An upcoming release of errors inbox will automatically track which versions of your software are producing errors. The version data will display in [CodeStream](https://docs.newrelic.com/docs/codestream/how-use-codestream/performance-monitoring/#buildsha).
