Skip to content

Commit

Permalink
Merge pull request #7045 from nr-ahemsath/add-logging-config-environm…
Browse files Browse the repository at this point in the history
…ent-vars

Document environment variable options for configuring .NET agent logging features
  • Loading branch information
zuluecho9 committed Apr 11, 2022
2 parents 2e324f6 + 08259f5 commit 9928d83
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3086,7 +3086,12 @@ request.headers.user-agent
</Callout>

### Application logging [#application_logging]



<Callout variant="important">
These configuration options are only available for .NET agent version 9.7.0 or higher.
</Callout>

The `applicationLogging` element is a child of the `configuration` element. Use `applicationLogging` to configure instrumentation of your application's logging activity.

There are three main sub-features:
Expand All @@ -3105,9 +3110,15 @@ For more details, see our documentation about [APM logs in context](/docs/apm/ne
</applicationLogging>
```

<Callout variant="important">
This configuration option is only available in the .NET agent v9.7.0 or higher.
</Callout>
These features can also be configured via environment variables:

```
NEW_RELIC_APPLICATION_LOGGING_ENABLED="true"
NEW_RELIC_APPLICATION_LOGGING_METRICS_ENABLED="true"
NEW_RELIC_APPLICATION_LOGGING_FORWARDING_ENABLED="false"
NEW_RELIC_APPLICATION_LOGGING_FORWARDING_MAX_SAMPLES_STORED="10000"
NEW_RELIC_APPLICATION_LOGGING_LOCAL_DECORATING_ENABLED="false"
```

The `applicationLogging` element supports the following attributes and sub-elements:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ You have three options to configure APM logs in context to send your app's logs
</applicationLogging>
```

This option can also be enabled by setting the environment variable `NEW_RELIC_APPLICATION_LOGGING_FOWARDING_ENABLED='true'`. The environment variable value, if present, takes precedence over the config file value.

This option may be on by default in a future agent version.

**Optional adjustments:**
Expand All @@ -75,6 +77,8 @@ You have three options to configure APM logs in context to send your app's logs
<forwarding enabled="true" maxSamplesStored="10000" />
</applicationLogging>
```

This setting can also be adjusted by setting the environment variable `NEW_RELIC_APPLICATION_LOGGING_FOWARDING_MAX_SAMPLES_STORED`. The environment variable value, if present, takes precedence over the config file value.

If you have an existing log forwarding solution and are updating your agent to use automatic logs in context, be sure to **disable your old log forwarder**. Otherwise, your app will be sending double log lines. Depending on your account, this could result in double billing. For more information, follow the procedures to disable your [specific log forwarder](/docs/logs/forward-logs/enable-log-management-new-relic#log-forwarding).

Expand All @@ -99,6 +103,8 @@ You have three options to configure APM logs in context to send your app's logs
</applicationLogging>
```

This option can also be enabled by setting the environment variable `NEW_RELIC_APPLICATION_LOGGING_LOCAL_DECORATING_ENABLED='true'`. The environment variable value, if present, takes precedence over the config file value.

Our decorator adds five attributes to every log message: `entity.guid`, `entity.name`, `hostname`, `trace.id`, and `span.id`. Example:

```
Expand Down

0 comments on commit 9928d83

Please sign in to comment.