tagged [serilog]

How to use Serilog in .NET Core Console app

How to use Serilog in .NET Core Console app I wanted my application to have capability of logging to a file, so I started to look for something more than default .NET Core 2.2 logging framework. I see...

11 Oct at 10:29

Why isn't Serilog writing Debug messages even when the level is set to Debug?

Why isn't Serilog writing Debug messages even when the level is set to Debug? I wrote the following line to create my logger in a C#/WPF application, but the Debug messages do not show up in the logs....

10 Jan at 21:59

How to configure and use Serilog in ASP.NET Core 6?

How to configure and use Serilog in ASP.NET Core 6? Since the recently introduced new structure of the Program.cs startup code, the documentation confuses me a bit. In the officially provided [Serilog...

24 Mar at 08:36

Add custom properties to Serilog

Add custom properties to Serilog I'm using Serilog with an MS SQL Server sink in my application. Let's assume I have defined the following class ... ... and created an instance: ``` var person = new P...

13 Aug at 14:31

serilog format SourceContext for showing only assembly name

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: ``` nam...

26 Jan at 21:57

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

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 t...

1 Nov at 15:1

Serilog's ILogger injected using Log.ForContext<T>, where T is the consumer

Serilog's ILogger injected using Log.ForContext, where T is the consumer Serilog allows creating a context-aware logger: `Log.ForContext()` I would like to register Serilog with SimpleInjector in such...

4 Jun at 08:42

Using a custom sink with ServiceStack.Logging.Serilog?

Using a custom sink with ServiceStack.Logging.Serilog? Is there a non-obvious way (to me at least) to add a custom sink e.g. MongoDB or MicrosoftTeams as part of instantiating the Serilog factory in t...

9 Aug at 22:8

How do I pass a dependency to a Serilog Enricher?

How do I pass a dependency to a Serilog Enricher? I'm using Serilog in my application for logging. When I'm configuring the logger, I have code like this: I want to inject some dependencies into my `M...

3 Oct at 18:53

Pattern to use Serilog (pass ILogger vs using static Serilog.Log)

Pattern to use Serilog (pass ILogger vs using static Serilog.Log) In a new project where was chosen as the logger I automatically started passing around `ILogger` interface. The code accesses `Log.Log...

6 Jun at 05:19

Getting error when upgrading from Serilog.Sinks.ApplicationInsights v3.1 to v4.0

Getting error when upgrading from Serilog.Sinks.ApplicationInsights v3.1 to v4.0 I have an Azure Function that uses Serilog to write to AppInsights with [Serilog AppInsights sink v3.1](https://github....

22 Jun at 23:22

How to config `Serilog` to write to the application directory with the cofig file?

How to config `Serilog` to write to the application directory with the cofig file? I'm using `Serilog` on a `.net core`. I want to config the log path to the application directory. I see there's an ex...

2 Apr at 12:26

servicestack and Serilog not working properly

servicestack and Serilog not working properly I have not been able to successfully implemented logging in service stack. I posted here and on serilog GIT. The Serilog team believes it is a service sta...

8 Jan at 17:42

Exception destructuring in Serilog

Exception destructuring in Serilog Serilog has a convenient way of destructuring objects as shown in this example: The first line causes the logger to log an exception as plain text (by calling ToStri...

15 Jun at 13:15

Serilog DI in ASP.NET Core, which ILogger interface to inject?

Serilog DI in ASP.NET Core, which ILogger interface to inject? I've successfully configured Serilog in my ASP.NET Core application, only the DI part remains. Now I have two ILogger interfaces, one is ...

Serilog and .NET Core 2.1 HostBuilder Configuration

Serilog and .NET Core 2.1 HostBuilder Configuration I'm using the .NET Core 2.1 HostBuilder class to set up and run a GRPC server and am having trouble getting SeriLog properly configured so that it i...

21 Oct at 00:53

Add Username into Serilog

Add Username into Serilog I have this Serilog configuration in ``` public class Program { public static IConfiguration Configuration { get; } = new ConfigurationBuilder() .SetBasePath(Dire...

3 Apr at 20:29

Configuring Serilog RollingFile with appsettings.json

Configuring Serilog RollingFile with appsettings.json I'm trying to configure Serilog for a .NET Core project. Here's what I have in my `appsettings.json`: ``` "Serilog": { "MinimumLevel": "Verbose"...

4 Dec at 23:24

How do I interpret Serilog configuration in ASP.NET Core 2.1?

How do I interpret Serilog configuration in ASP.NET Core 2.1? For some reason, I find it very hard to understand what's going on with Serilog configuration. I have a web api with .NET Core 2.1 and ins...

6 May at 05:53

How to add my own properties to Serilog output template

How to add my own properties to Serilog output template I have a small application that is receiving messages from a service bus, which can send through several different types of events for different...

2 Feb at 22:31

OpenTracing doesn't send logs with Serilog

OpenTracing doesn't send logs with Serilog I'm trying to use [OpenTracing.Contrib.NetCore](https://github.com/opentracing-contrib/csharp-netcore) with Serilog. I need to send to Jaeger my custom logs....

Filter Serilog logs to different sinks depending on context source?

Filter Serilog logs to different sinks depending on context source? I have a .NET Core 2.0 application in which I successfully use Serilog for logging. Now, I would like to log some database performan...

C# ASP.NET Core Serilog add class name and method to log

C# ASP.NET Core Serilog add class name and method to log I recently added logging to my ASP.Net Core project. Currently the log writes to a .txt file in this format: > {Timestamp:yyyy-MM-dd HH:mm:ss.f...

SerilogFactory don't log my messages but it logs exceptions

SerilogFactory don't log my messages but it logs exceptions I want to use the SerilogFactory, the LogFactory is initialized before initializing the AppHost. This is my startup.cs : ``` public class St...

3 Jul at 19:56

Invalid cast from 'System.String' to 'Serilog.Core.IDestructuringPolicy'

Invalid cast from 'System.String' to 'Serilog.Core.IDestructuringPolicy' From studying [Serilog.Sinks.AzureTableStorage](https://github.com/serilog/serilog-sinks-azuretablestorage/tree/master) I have ...

20 Jun at 09:12