-
Notifications
You must be signed in to change notification settings - Fork 210
Closed
Labels
Description
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 #359 (comment)