Closed alex-todorov-j2 closed 9 months ago
indeed, i forgot to configure the OTLP exporter.
I ended with this code and it started to work fine:
var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]); var logBuilder = new LoggerConfiguration() .Enrich.FromLogContext() .WriteTo.Console(); if (useOtlpExporter) { logBuilder .WriteTo.OpenTelemetry(options => { options.Endpoint = builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]; options.ResourceAttributes.Add("service.name", "apiservice"); }); } Log.Logger = logBuilder.CreateBootstrapLogger(); builder.Logging.AddSerilog();
Originally posted by @BartNetJS in https://github.com/serilog/serilog-aspnetcore/issues/359#issuecomment-1919390758
Created in wrong place
I ended with this code and it started to work fine:
Originally posted by @BartNetJS in https://github.com/serilog/serilog-aspnetcore/issues/359#issuecomment-1919390758