Skip to content

Instantly share code, notes, and snippets.

@cocowalla
cocowalla / open-telemetry-config.cs
Created May 31, 2023 14:10
A rough example of how to use Serilog.Sinks.OpenTelemetry to send logs to Azure Application Insights
builder
.UseSerilog((ctx, _, logConfig) =>
{
logConfig.ReadFrom.Configuration(ctx.Configuration, "Log");
}, writeToProviders: true)
.ConfigureServices((ctx, services) =>
{
services.AddOpenTelemetry()
.ConfigureResource(res => {
...
@coenm
coenm / LogRequestResponseHelper.cs
Created January 9, 2015 08:03
Owin Middleware Logging
using System;
using Microsoft.Owin;
using NLog; // Using NLog in this example
namespace com.github.gist.coenm
{
public static class LogRequestResponseHelper
{
public static void LogDebugResponse(Logger logger, IOwinResponse response)
{