Questions tagged [serilog]

Serilog is a .NET library which provides diagnostic logging to files, the console, and so-on. Consider using this tag along with the .net framework version you are using for extra clarity

Serilog is a library that provides diagnostic logging to files, the console, and so-on. It is easy to set up, has a clean API, and is portable between recent .NET platforms.

Unlike other logging libraries for .NET, Serilog is built with structured log data in mind. Parameters passed along with log messages are not destructively rendered into a text format. Instead, they're preserved as structured data that can be written in document form to a data store.

Useful links

2233 questions
1
vote
3 answers

Log when my ASP.NET Core app launches successfully or when it doesn't

So I've recently started with creating and programming an ASP.NET Core 2.0 application. I've been getting the logging to work using Serilog and I can write to a .txt log file on my local computer. The path to this file is written in my…
Jeroen
  • 1,625
  • 3
  • 16
  • 28
1
vote
1 answer

How can I use settings with reloadOnChange and LoggingLevelSwitch in Serilog

Using Serilog and Serilog.Settings.Configuration in .NET Core 2, I'd like to do something like the following. Is it possible? appsettings.json { "Serilog": { "MinimumLevel": { "ControlledBy": { "Serilog.Core.LoggingLevelSwitch":…
Dave
  • 332
  • 1
  • 7
1
vote
0 answers

ASP.NET Core logging with Serilog

I am trying to understand why my application does not log the same number of informations when executed from visual studio and/or under IIS. This is my startup code (constructor) related to logging: Log.Logger = new LoggerConfiguration() …
Lorenzo
  • 29,081
  • 49
  • 125
  • 222
1
vote
1 answer

Serilog logger for each plugin DLL in One Application

My use-case is multiple unrelated DLLs running as plugins in AutoCAD. Each one has the static global Serilog Logger as described at https://github.com/serilog/serilog/wiki/Lifecycle-of-Loggers#in-all-apps. They are all configured to write to Rolling…
CAD bloke
  • 8,578
  • 7
  • 65
  • 114
1
vote
2 answers

Serilog integration in .Net core 2.0 Class Library Project

I would like to use Serilog for logging in .Net core 2.0 class library project. I have searched many places and did not find any example for integrating the Serilog in class library project. Can anybody refer a sample? Thanks.
Prasad
  • 31
  • 1
  • 3
1
vote
0 answers

Serilog doesn't clean log files despite configuration

Logger.cs: using System.Configuration; using System.Threading; using System; using Serilog; using Serilog.Enrichers; using Serilog.Events; using Serilog.Sinks.RollingFile; namespace my.package.Logger { public static class Logger { …
Sebas
  • 21,192
  • 9
  • 55
  • 109
1
vote
1 answer

How to read configuration from appsetings.json for custom serilog sink in asp.net core 2.0

I created the custom sentry sink inside my API project. public class SentrySink : ILogEventSink {...} I also created an extension method for my sink so that I can connect my sink through logging configuration. public static LoggerConfiguration…
1
vote
1 answer

How to add a request identifier to OWIN requests using Serilog?

I'm trying to get the same as with using SerilogWeb.Classic.WebApi using this: app.Use(async (owinContext, next) => { using (Serilog.Context.LogContext.PushProperty("HttpRequestId", Guid.NewGuid())) { await next(); } }); and…
Paulo Morgado
  • 14,111
  • 3
  • 31
  • 59
1
vote
1 answer

Pushing the logs from IdentityServer to sumoLogic via SerilLog: How we can combine sequential related log entries to one

We are using IdentityServer4 and sending logs to SumoLogic. We are pushing the logs from IdentityServer to sumoLogic via SerilLog and SumoLogic treats each log entry as a separate message. So whats happening is basically one error is getting…
Neha
  • 11
  • 1
1
vote
2 answers

Using C# params with serilog

Just starting using Serilog + ElasticSearch and was wondering if there is an elegant way to log a params object array in one log entry. So far the only way I have been able to manage it is looping through each params which creates a separate log…
Hershizer33
  • 1,206
  • 2
  • 23
  • 46
1
vote
1 answer

Serilog - show object in details area, but not in summary message

Below is a sample trace as shown in Seq from Serilog. I would like the SensorInput to be in the details area, but not serialized as the message. How can I have SensorInput show only in the details area? var sensorInput = new { Latitude =…
John Livermore
  • 30,235
  • 44
  • 126
  • 216
1
vote
0 answers

Using Serilog over a service

I have a web application that is split into two sections, website and API. The website sits within the DMZ so is segregated from our internal network, for this reason all data access is done via the API which is internal. Our Seq server is internal.…
m.edmondson
  • 30,382
  • 27
  • 123
  • 206
1
vote
1 answer

Serilog Appsettings and setting filters

Using the Serilog.Settings.AppSettings project I am having difficulty setting a filter to exclude certain namespaces from a configured sink. In code I would do something like…
vm2013
  • 304
  • 2
  • 14
1
vote
1 answer

Serilog with seq cant find System.Net.Http after publish on windows with 4.6.2

So I am having trouble getting apps to run after they have gone through a publish process. They work from the visual studios debugger, since a version of System.Net.hhtp is put into the debug directory. I believe that this dll is ngened and stored…
BillHaggerty
  • 6,157
  • 10
  • 35
  • 68
1
vote
1 answer

How can I get "controlLevelSwitch" to work in the Serilog Seq sink

I have my application set up with Serilog logging and the Seq sink (in addition to a ColoredConsole and a RollingFile sink). Everything is working great but the minimum log level switching from Seq. My logging level switch is set up with a starting…
siabrac
  • 11
  • 3