2,470 questions
0
votes
2
answers
105
views
Serilog Date Format using appsettings.json
I am having an issue formatting the date in the filename using the appsettings.json file for a C# worker service.
My current config looks like this:
Serilog": {
"WriteTo": [
...
Best practices
1
vote
1
replies
76
views
Using Spectre.Console.Cli with Generic Host
I have a CLI app in .NET, built with Spectre.Console.Cli package. I use ServiceCollection with Spectre ITypeResolver and ITypeRegistrar interfaces to wire up the DI. That works great, but now I want ...
-1
votes
2
answers
101
views
How to mock ILogger and invoke via callback Console.Writeline to have invocations in test explorer?
I need to have every invocation from the ILogger interface of a test,
but I mock the ILogger interface in the class that is going to be tested, so it won't write to console and therefore the ILogger ...
1
vote
1
answer
56
views
.NET Serilog ReadFrom Configuration doesn't work
Working version:
private static void SetLogging(WebApplicationBuilder builder)
{
Log.Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.MinimumLevel.Override("...
1
vote
1
answer
118
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 ...
1
vote
1
answer
164
views
Serilog PushProperty with additional properties
The code snippet below:
Log.Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.MinimumLevel.Verbose()
.WriteTo.Console(outputTemplate: "{Timestamp:HH:mm:ss} [{Level:u3}] {Message}{...
2
votes
0
answers
102
views
How to suppress TickerQ logs while using Serilog?
I'm using TickerQ in my .NET 9 web project and want to suppress all infrastructure logs (SQL, HTTP requests, etc.) so only my own application logs (and errors) show up.
TickerQ Packages:
<...
1
vote
0
answers
61
views
Serilog not logging after first request in ASP.NET Core Web API running as Windows service
I've been unable to figure this one out and am wondering if anyone has any ideas. This is an ASP.NET Core Web API running as a Windows service.
It will log to a file at the absolute path I specify for ...
0
votes
0
answers
105
views
Serilog Splunk .NET 8, Splunk stores all messages in one
In my ASP.NET Core 8 web app, I am trying to log the messages to Splunk. Splunk shows all the messages in a single message (nested JSON, very difficult to read messages). I want to store only the ...
0
votes
1
answer
63
views
Serilog xml-based config sublogger not working
I would like writing regular logs to log.csv, statistics info to separate log files. (.NET Framework 4.7.)
Instantiated in code - I want to keep it minimal and have purely xml-based config.
Log.Logger ...
1
vote
2
answers
143
views
How can I make a Serilog filter match against any member of a set of EventIds?
I can't find a good example of how to match an EventId in a filter.
(Note: I found an outdated solution that looks like Filter.ByIncludingOnly("EventId.Id = 2003"), but this does not work ...
0
votes
0
answers
34
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 ...
0
votes
2
answers
203
views
Serilog not writing to file when hosted on IIS (ASP.NET Core 8 Web API)
I'm working on an ASP.NET Core 8 Web API project using Serilog to log to both the console and a file.
Everything works perfectly in development (when running locally via Visual Studio), but when I ...
0
votes
1
answer
50
views
How can I overwrite one item in an array in the appsettings stack when the item is moderately complex? [closed]
I have an ASP.NET Core MVC app using Serilog. Sinks are configured in the appsettings.json. I have a few sinks.
One of the sinks is not behaving. Typically I would overwrite the values of the ...
1
vote
1
answer
74
views
How to make SEQ display a colored metric badge (highlight) for elapsed time in log messages?
I’m using SEQ for structured logging in my .NET application (Serilog).
I want SEQ to display a colored badge (highlight) with the elapsed time (in ms) on the right side of the log message, just like ...