Category "serilog"

How to silence Serilog in integration tests with the new minimal hosting model of .NET 6

I have a .NET 6 web API project with existing integration tests for some of the API endpoints. The project uses Serilog for logging and everything was fine so f

How to get Serilog to enrich logs

I've set Serilog to read its config from appsettings.json: return WebHost.CreateDefaultBuilder(args) .UseSerilog((ctx, config) => { config.ReadFrom.Confi

Logging to elastic search with serilog and ILogger

I have written a function to return an ILogger instance. This way I can get consistent logging in all my code. My problem is that when called from different typ

Serilog in Blazor server .Net6 to split error messages to a different file

In serilog, I need to split the information in two files. i.e one file should contain the Information and the other should contain the error. with the below c

Can a Serilog.ILogger be converted to a Microsoft.Extensions.Logging.ILogger?

I have code that logs to Microsoft.Extensions.Logging.ILogger (and extension methods, mostly). I have configured Serilog to actually do the logging. I can't fin

How Serilog posts to CloudWatch without any configuration setup?

I am migrating an app done in net core from Azure to AWS. Backend is an Asp.NetCore WebApi which uses Serilog for logging. I simply put it behind a subclass of

Logging errors by serilog-timings at loglevel "Error"

I show my idea on the serilog-timing example. public static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .Enrich.FromLogContext

How to use Serilog.Log.ForContext with F# function or C# Method

Using Serilog and F# how to use .ForContext with functions? it appears it only accepts type classes: type A()= log = Serilog.Log.ForContext<A>() // c

Reload Serilog JSON Configuration on changes in .NET Core 2.1

I'm currently working on a ASP.NET Core 2.1 application and I use Serilog for logging. I want to reload the application settings file for my Serilog implementat

Check that Serilog is configured correctly

In my ASP.NET Core Web API application I have a Serilog set up to log different types of events (Information, Warning etc) into different tables in a SQL Server

Is it possible to get Timestamp in output template as DateTimeKind.Utc?

Currently when I use {Timestamp} in an outputTemplate it appears to have been generated by DateTime.Now and therefore being of DateTimeKind.Local flavor since,

Serilog logging to Azure eventhub stopped working after moving project to .Net Core 5

I have a .Net Core 3.1 project that uses Serilog and posts messages to Azure Eventhub. The problems started when we moved it to .Net 5. Here's how it's configur

Serilog not writing to file on Ubuntu

I have deployed a website to a ubuntu machine but unable to get serilog to write to file Here is what I have: In Program.cs (omitted unnecessary parts): public

serilog format SourceContext for showing only assembly name

I configured my project to use Serilog for logging using dependecy injection. I use the following schema in the classes constructor: namespace FlickPopper.API

Polly -how do I log final error and continue?

I'm trying to set up Polly in .Net Core 3.1 (Azure Functions v3). I want to create a Policy in the Startup class which I can inject into functions. The beha

Use Serilog with Microsoft.Extensions.Logging.ILogger

I've created a .NET Core 3.1 project using a Host, the IoC container with IServiceCollection and implemented logging allover the place using the ILogger<T>

.Net Core 3.1 - Set ForContext for Serilog with Microsoft Ilogger interface

How to dynamically set ForContext property for Serilog logger using Ilogger interface from Microsoft.Extensions.Logging? Here's the code: private readonly ILogg

How to implement Serilog Custom Sink outputTemplate parameter

How do I implement outputTemplate that is common to most sinks? For example this works: Logger = new LoggerConfigruration() .WriteTo.Console(outputTemplate:

Serilog set flush interval

I'm using serilog in my ASP Core 2.2 application. Everything works great but I can't set flushToDiskInterval. It means that I want to flush logs to disk every m