Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Filter by
Sorted by
Tagged with
1 vote
1 answer
95 views

ASP.NET Core 8.0 web app on Linux looking for System.Text.Json 9.0.0.0

I've moved my ASP.NET Core 8.0 web application (and API) from Windows to Linux and everything worked great. I changed how the solution was using Nuget packages to centrally manage the versions but ...
tippers's user avatar
  • 61
0 votes
0 answers
30 views

Serilog tracing in Azure Functions using different triggers

I am trying to enable Serilog Tracing (serilog-tracing 2.3.1) in our system. It works well with http communication between our internal processes in my experiments. However, one of our components is ...
bit0001's user avatar
  • 554
1 vote
0 answers
68 views

Don't save logs for HttpMessageHandler using Serilog

In my ASP.NET Core web application, I use Serilog to save all the logs in SQL Server. After that, I see a lot of messages like that: Ending HttpMessageHandler cleanup cycle after 0.0046ms - processed: ...
Enrico's user avatar
  • 6,862
1 vote
1 answer
51 views

Truncate Serilog Message to Specific Length Without Affecting ASP.NET Core Diagnostics

Currently I can truncate Serilog to specific length using following Enricher Class: public class WithTrimmedMessage(int maxLength) : ILogEventEnricher { public void Enrich(LogEvent logEvent, ...
JazzyHacker's user avatar
1 vote
0 answers
46 views

Can't Display Event Id Property on Serilog

I'm using Serilog.AspNetCore v9.0.0. I can display {EventId} in the logging output format and displayed as follow: { Id: 14, Name: "ListeningOnAddress" } But it will display empty string if ...
JazzyHacker's user avatar
1 vote
0 answers
37 views

How to custom format (shorten) the values of ActionName and SourceContext using Serilog.AspNetCore?

What is the most efficient way of logging the shortened versions of the ActionName and SourceContext properties using Serilog.AspNetCore in an ASP.NET Core app? For the SourceContent, I'd like to ...
Alek Davis's user avatar
  • 10.8k
1 vote
0 answers
232 views

SeriLog DI changed in .NET 8 with DiagnosticContext needing a logger injected

In my ASP.NET Core 8.0 Web API, I ran into an runtime issue with Serilog and DiagnosticContext. My previously working config is as follows: public static WebApplicationBuilder AddLogging(this ...
Chaos's user avatar
  • 139
0 votes
1 answer
102 views

How to filter logs/traces in OTEL and Azure Monitor Exporter .NET

I've been trying to find how to filter logs/traces of different levels to specific destinations. A destination and filter rule would be Write everything to stdout (For viewing in logs in container ...
joacar's user avatar
  • 961
3 votes
1 answer
190 views

Serilog logging too much information

I have a Blazor Server app being hosted in a Azure App Service and want to customize the logging. I’m trying Serilog for the first time and after watching a couple videos I as able to get it to at ...
Caverman's user avatar
  • 3,859
1 vote
0 answers
146 views

Serilog does not log Exceptions despite setting MinimumLevel to Information

I'm working on a ASP.NET Core MVC application and would like to use Serilog both for logging trace messages (Information) and Exceptions to Application Insight. The configuration code (from Program....
user29807957's user avatar
0 votes
2 answers
118 views

Excluding AppRequests in Serilog Azure App Insights Sink

I'm working on an ASP.NET application and using Azure AppInsights and Serilog Sink https://github.com/serilog-contrib/serilog-sinks-applicationinsights for pushing the logs. However one problem I have ...
Yehia A.Salam's user avatar
1 vote
1 answer
406 views

Centralized logging support with OpenTelemetry and Serilog

I am currently using a centralized configuration for OpenTelemetry logging. This configuration is then called at startup from every single service directly in Program.cs With this configuration I am ...
Mammt's user avatar
  • 67
3 votes
1 answer
2k views

How to send logs to Application Insights with Serilog and Azure Monitor OpenTelemetry?

I want to see my ASP.NET Core application's logs in Application Insights. I'm using the following packages: Azure.Monitor.OpenTelemetry.AspNetCore Serilog.AspNetCore Serilog.Sinks.OpenTelemetry This ...
mrk's user avatar
  • 131
0 votes
1 answer
250 views

Blazor WASM - Use Serilog to log to Server

I have a .NET 8 Blazor WASM web application. I am trying to implement Serilog to push logs back to my API Server application. I saw this thread: Use serilog as logging provider in blazor webassembly ...
Airn5475's user avatar
  • 2,490
0 votes
1 answer
703 views

Prevent noisy log events with ASP.NET Core Healthchecks and Serilog

I want to use healthchecks and Serilog (with request logging), but I get a flood of useless log events, as well as ones for the failure cases. The v8 docs (and this) show there are differences between ...
lonix's user avatar
  • 22.4k
3 votes
1 answer
405 views

Registering Serilog with Logging.AddSerilog vs Services.AddSerilog

There are two ways to register Serilog. The "old" way (shown in countless SO questions and tutorials): //builder.Logging.ClearProviders(); // optional builder.Logging.AddSerilog(); And ...
lonix's user avatar
  • 22.4k
0 votes
1 answer
102 views

Adding new property in the Log file using Serilog

Using Serilog, I want to have a new property Identifier (right after "Timestamp") in the log file like below: {"Timestamp":"2019-10-11T12:18:51.1488404+08:00", "...
Yeasin Abedin's user avatar
1 vote
1 answer
171 views

Serilog async sink with health monitoring

The Serilog async sink has a health monitoring feature, where one must implement IAsyncLogEventSinkMonitor to monitor when the buffer is overwhelmed and log events are dropped. The sample shown is ...
lonix's user avatar
  • 22.4k
1 vote
1 answer
146 views

Toggle Serilog sink at runtime

I'm using code-based Serilog config (not appsettings). I want to toggle a sink at runtime; specifically Seq, but others too. I know of the WriteTo.Conditional feature: var isFooEnabled = true; var ...
lonix's user avatar
  • 22.4k
1 vote
0 answers
74 views

What is the proper way to add extra data over push context with Serilog

I would like to log an extra data with an active log context but I have to use different methods: For example, I am trying to log web api requests with following settings: On Program.cs at the top: ...
mehmetilker's user avatar
0 votes
1 answer
369 views

Stop Serilog from logging HTTP GET in ASP.NET Core MVC

Serilog is successfully logging but it is logging HTTP GET api calls automatically. How can the HTTP calls be suppressed? I have entries like this in the log file: 2024-10-25 06:24:10.040 -04:00 [INF] ...
Steve's user avatar
  • 13
1 vote
1 answer
464 views

How to format log with Serilog.Sinks.Seq

I'm new to both Serilog and Seq, and I'm trying to format the logs injested in Seq in a specific way. I've configured two sinks, one for the console and one for seq, in my appsettings file. For my ...
BOGsi's user avatar
  • 79
0 votes
0 answers
104 views

How to store different types of logs in different files in Serilog .NET 8

I want to store logs in different file based on type. Let's say for for API Request log - request-.txt; EF Core Query - log-.txt I have installed Serilog packages, and it works fine but file ...
JOYBOY's user avatar
  • 75
0 votes
1 answer
43 views

Programmatically specify a value within appsettings.json

I am trying to set up a logging system that adds log files to subfolders based on the year. However I've been unable to programmatically specify the year. I can hardcode it and it works fine, but I ...
L. Wallach's user avatar
0 votes
0 answers
99 views

Serilog - write a single Log file every hour

I have the following .Net Core - appsetting. It writes the log but writes multiple log files. Like this: How can I get write a single file every hour? thx!! Help! log-2024080512_001.txt 8/5 ...
Jon's user avatar
  • 1,757
0 votes
1 answer
422 views

Serilog.Sinks.Email Send to pickup directory

Is it possible for serilog to send emails to pickup directory? I don't actually want to send emails right now it's just a POC. Thank you
David's user avatar
  • 5,557
0 votes
1 answer
208 views

Serilog categorized multiple Sinks

I want to separate my logs in three different parts. Searched for logging libraries and the best one I found is Serilog. write http request logs to daily rolling txt files. write logs containing ...
Kazem Ma's user avatar
2 votes
2 answers
566 views

How to set username and password for authetication Serilog.Sinks.Email 4.0?

I would like to send email when error occurs in my NET 8.0 application. { "Name": "Email", "Args": { "From": "[email protected]", "Host&...
Géza's user avatar
  • 173
1 vote
1 answer
298 views

Logging Http in file but not in database using Serilog

I have a ASP.NET core web API where I'm using Serilog to do the logging. I want to log Info from Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware in the log-file, but in the database I only want ...
Peter Poulsen's user avatar
2 votes
1 answer
545 views

How to have Single Line Exception in Serilog Expressions Format?

I am trying to make a customized json log output using Serilog Expressions Format. I am using below template : "template": "{{\"Time\": \"{@t:yyyy-MM-ddTHH:mm:ss....
ayush garg's user avatar
0 votes
0 answers
85 views

Serilog File Name Include Domain Name

How can i add Domain name as a part of my Serilog file The start up code is like below on Startup.cs file // This method gets called by the runtime. Use this method to add services to the container. ...
Sebastian's user avatar
  • 4,861
1 vote
2 answers
1k views

Configure Serilog to log to different sinks using Serilog Expressions

I am trying to get Serilog in my asp.net core project to log certain types of logs to a different sink depending on what is being logged, but all I end up with is 2 seperate logs with the exact same ...
Andrew Efurhievwe's user avatar
1 vote
1 answer
297 views

Output with parameters in Serilog does no work

In a .Net Core Webapi project I am using Serilog to log. But when I use _logger.LogInformation("Token for user {UserName} created",data.username); and check the log file, the output is "...
AoLiGei's user avatar
  • 81
1 vote
0 answers
92 views

Use outputTemplate in HTTP sink for Exception logging

Trying to send logs to remote http server using serilog-sinks-http and Serilog.Exceptions is required to get exception details. In Serilog.Exceptions documents it required outputTemplate to be set to {...
Kazem Ma's user avatar
1 vote
1 answer
157 views

aws-logging-dotnet retrieve the AWS Logger LogStreamName value at runtime

I am using the aws-logging-dotnet library to write the application logs to AWS Cloudwatch. The logger is configured via a json file: { "Serilog": { "Using": [ "AWS....
Marco Merola's user avatar
  • 1,037
0 votes
1 answer
159 views

have serilog logs reference the code where the log originated

For example right now I'm getting this log from serilog: The query uses the 'First'/'FirstOrDefault' operator without 'OrderBy' and filter operators. This may lead to unpredictable results. and this ...
buga's user avatar
  • 1,382
1 vote
1 answer
197 views

Serilog not injecting `Microsoft.Extensions.Logging.ILogger<T>`

Adding Serilog to my ASP.NET Core (.NET 8) project, following the instructions in the serilog-aspnetcore repo. Everything appears to be in order; however if I try to inject a Microsoft.Extensions....
TaffarelJr's user avatar
1 vote
0 answers
280 views

Why is asp.net logging twice, once with a default setting and once with my serilog settings?

I am using .net 8 and Serilog.AspNetCore 8.0.1 This is my config: builder.Logging.ClearProviders(); builder.Host.UseSerilog((context, provider, configuration) => configuration .ReadFrom....
mrt181's user avatar
  • 5,336
1 vote
1 answer
370 views

How to pass compile-time logging source generation code method input as serilog.Ilogger instead of Extensions.Logging?

Below is sample code for passing Microsoft.Extensions.logging as input of logging partial method.but my scenarios is how pass Serilog.Ilogger as input of logging partial method. [LoggerMessage(...
ramu yepuganti's user avatar
-1 votes
1 answer
159 views

how to logging Compile-time logging source generator log information in logfile in .net 6

logging Compile-time logging source generator log info in logfile in .net 6.but in my case it can't logging. so can you please help me.
ramu yepuganti's user avatar
1 vote
1 answer
286 views

Compile-time logging source generator is not compatible with Serilog/NLog?

Compile-time logging source generator is not compatible with Serilog/NLog? Can you anybody please respond.
ramu yepuganti's user avatar
0 votes
1 answer
141 views

How to get current user logged in for EnvironmentUserName instead of "IIS APPPOOL\DefaultAppPool" when web app is deployed to IIS [duplicate]

I have a basic CRUD web app that saves user form input to a database. The the current user id is saved along with the form input without any issues both locally and on IIS. However, when I save ...
Jesslyn's user avatar
  • 706
1 vote
1 answer
460 views

How to use filter with Serilog.Sinks.EventLog

I'm really not sure what I'm missing. Filtering is not working at all for Serilog.Sinks.EventLog. Everything gets logged no matter what I've tried in the Filter configuration. I've used old syntax, ...
Howard Shank's user avatar
0 votes
1 answer
594 views

Serilog Not Logging to File

I am attempting to log both errors and information on API requests in my .NET Core 6 project. After setting it up in my Program.cs file it does output a log entry to the desired location. Below is my ...
Deus Ex Machina's user avatar
2 votes
1 answer
290 views

Serilogs | How to turn off Blazor http calls?

I am trying to turn off all the logs except the logs I put in directly in my application. I see a lot of http post and get calls from Blazor. How can I ignore those? HTTP "POST" "/...
tvbRPTI2754's user avatar
0 votes
1 answer
499 views

How do I update Dotnet Serilog Logging Config to Deal with new Elasticsearch 8 security (https, username, password, tls cert)?

I've upgraded to Elastic 8.x from 7.x. Now my elastic endpoint requires connecting using https with a username, password and a tls cert. See examples here. If I use this approach within my kubernetes ...
Matthew S's user avatar
  • 1,040
0 votes
1 answer
861 views

Serilog ElasticSearch Sink custom properties

I'm trying to log to my Elasticsearch instance some data from .NET 6.0 Web Api with Serilog.AspNetCore and Serilog.Sinks.Elasticsearch installed, but I need to use custom properties for example: ...
Pan Michal's user avatar
0 votes
0 answers
418 views

catch exception of serilog sink

Im trying to catch an exception in an asp.net core app which seems to be not directly on application level. Im using serilog with Serilog.AspNetCore and an mqtt-sink: builder.Host.UseSerilog((ctx, ...
pyrogen's user avatar
  • 239
2 votes
0 answers
2k views

NET8 Blazor and Serilog

I'm creating a new Blazor Application with NET8. In the main project, the "server" project that contains the Blazor Client, I tried to add Serilog adding at the top of the Program.cs Log....
Enrico's user avatar
  • 6,862
0 votes
1 answer
82 views

Windows microservice created from .net core using does not write logs to path

Windows microservice created from .net core using does not write logs to path I have created a windows service from c# .net core which uses Serilog.Sinks.Async.File in appsettings.json as below "...
arbck90's user avatar