• /
  • ログイン
  • 無料アカウント

.NET: Configure logs in context

Logs in context for the .NET agent connects your logs and APM data in New Relic. Bringing all of this data together in a single tool helps you quickly get to the root cause of an issue and find the log lines that you need to identify and resolve a problem.

Set up your .NET app

To enable logs in context for APM apps monitored by .NET:

  1. Make sure you have already set up logging in New Relic. This includes configuring a supported log forwarder that collects your application logs and extends the metadata that is forwarded to New Relic.
  2. Install or update to the latest .NET agent version, and enable distributed tracing. Use .NET agent version 8.21 or higher and the New Relic .NET agent API version 8.21 or higher for logs in context.
  3. Install or update to Microsoft .NET Framework 4.5 or higher or .NET Core 2.0 or higher.
  4. Install and configure any of the following logging extensions to enrich your log data, including:
  1. Check your log data in the New Relic UI.

Configure log4net extension

You can use the Apache log4net version 2.0.8 or higher extension to link your log data with related data across the rest of the New Relic platform.

Configure NLog extension

You can use our NLog 4.5 or higher extension to link to your log data with related data across the rest of the New Relic platform.

Configure Serilog 2.5 or higher extension

You can use our Serilog extension to link to your log data with related data across the rest of the New Relic platform. This requires:

View logs in the UI

To verify that you have configured the log appender correctly, run your application, then check your logs data in New Relic One using the query operator has:span.id has:trace.id.

If everything is configured correctly and your data is being forwarded to New Relic with the enriched metadata, your logs should now be emitted as JSON and contain trace.id and span.id fields. If you don't see log data in the UI, follow the troubleshooting procedures.

What's next?

After you set up APM logs in context, make the most of your logging data:

問題を作成する
Copyright © 2020 New Relic Inc.