Structured event logging is so much more than just writing a message to a file. Since .NET Core natively supports structured event logging, I wanted to introduce a logger that takes advantage of these additional features. Serilog is an easy to configure and easy to use logging system that you can plug into a .NET Core project within minutes. Today we are going to configure Serilog, see how to use it in a basic logging scenario, then take advantage of the structured logging by hooking up a visual event sink called Seq.
Mailing List: https://signup.iamtimcorey.com/
Intro to Logging:
https://youtu.be/oXNslgIXIbQ
Getting Started with Docker: https://www.iamtimcorey.com/p/getting-started-with-docker/
Source Code: https://leadmagnets.app/?Resource=LoggingWithSerilog
0:00 - Intro
1:29 - Getting started: ASP .NET Core application
4:18 - Built in logging system crash course
8:08 - Exceptions in log messages (built in)
10:27 - Additional information in log message: variables in the log message (built in)
13:42 - Setting up Serilog
17:33 - Serilog NuGet references and configuration
21:38 - Logging application start and crash with Serilog
24:35 - Use Serilog over default built in logging system
25:00 - appsetings.json
29:47 - Serilog Enrichers: settings and NuGet references
32:27 - Writing the log messages to Console
34:29 - Logging request messages
38:11 - Writing the log messages to text file
40:49 - Structured logging: writing the log messages to json file
46:42 - Seq
48:39 - Setting up Seq with docker: NuGet reference, configuration, docker setup
59:15 - Logging with Seq
1:02:34 - Summary and concluding remarks