---
title: Ruby agent logs in context settings
source: https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration-logs-in-context-settings
---

Configure the Ruby agent's application logging settings to control log forwarding, local decoration, custom attributes on log events, and log metrics collection.

## Application Logging [#application-logging]

The Ruby agent supports [APM logs in context](https://docs.newrelic.com/docs/apm/new-relic-apm/getting-started/get-started-logs-context). For some tips on configuring logs for the Ruby agent, see [Configure Ruby logs in context](https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-ruby).

Available logging-related config options include:

**application_logging.enabled**

| TypeBoolean                                           |
| ----------------------------------------------------- |
| Defaulttrue                                           |
| Environ variableNEW_RELIC_APPLICATION_LOGGING_ENABLED |

If `true`, enables log decoration and the collection of log events and metrics.

**application_logging.forwarding.enabled**

| TypeBoolean                                                      |
| ---------------------------------------------------------------- |
| Defaulttrue                                                      |
| Environ variableNEW_RELIC_APPLICATION_LOGGING_FORWARDING_ENABLED |

If `true`, the agent captures log records emitted by your application.

**application_logging.forwarding.log_level**

| TypeString                                                         |
| ------------------------------------------------------------------ |
| Default"debug"                                                     |
| Environ variableNEW_RELIC_APPLICATION_LOGGING_FORWARDING_LOG_LEVEL |

Sets the minimum level a log event must have to be forwarded to New Relic. Logs at the configured level and any higher severity are forwarded, for example, `debug` forwards all log events, while `error` forwards only `error`, `fatal`, and `unknown` events. Valid values, lowest to highest severity: `debug`, `info`, `warn`, `error`, `fatal`, `unknown` (case-insensitive).

This ordering is based on the integer values of Ruby's `Logger::Severity` constants (see <https://github.com/ruby/logger/blob/113b82a06b3076b93a71cd467e1605b23afb3088/lib/logger/severity.rb>).

**application_logging.forwarding.custom_attributes**

| TypeHash                                                                   |
| -------------------------------------------------------------------------- |
| Default{}                                                                  |
| Environ variableNEW_RELIC_APPLICATION_LOGGING_FORWARDING_CUSTOM_ATTRIBUTES |

A hash with key/value pairs to add as custom attributes to all log events forwarded to New Relic. If sending using an environment variable, the value must be formatted like: "key1=value1,key2=value2"

**application_logging.forwarding.labels.enabled**

| TypeBoolean                                                             |
| ----------------------------------------------------------------------- |
| Defaultfalse                                                            |
| Environ variableNEW_RELIC_APPLICATION_LOGGING_FORWARDING_LABELS_ENABLED |

If `true`, the agent attaches [labels](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration-general-settings#labels) to log records.

**application_logging.forwarding.labels.exclude**

| TypeArray                                                               |
| ----------------------------------------------------------------------- |
| Default\[]                                                              |
| Environ variableNEW_RELIC_APPLICATION_LOGGING_FORWARDING_LABELS_EXCLUDE |

A case-insensitive array or comma-delimited string containing the labels to exclude from log records.

**application_logging.forwarding.max_samples_stored**

| TypeInteger                                                                 |
| --------------------------------------------------------------------------- |
| Default10000                                                                |
| Environ variableNEW_RELIC_APPLICATION_LOGGING_FORWARDING_MAX_SAMPLES_STORED |

Defines the maximum number of log records to buffer in memory at a time.

**application_logging.local_decorating.enabled**

| TypeBoolean                                                            |
| ---------------------------------------------------------------------- |
| Defaultfalse                                                           |
| Environ variableNEW_RELIC_APPLICATION_LOGGING_LOCAL_DECORATING_ENABLED |

If `true`, the agent decorates logs with metadata to link to entities, hosts, traces, and spans.

**application_logging.metrics.enabled**

| TypeBoolean                                                   |
| ------------------------------------------------------------- |
| Defaulttrue                                                   |
| Environ variableNEW_RELIC_APPLICATION_LOGGING_METRICS_ENABLED |

If `true`, the agent captures metrics related to logging for your application.
