C# Logging with Serilog and Seq – Structured Logging Made Easy

26
1



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.

Patreon:
Mailing List:
Intro to Logging:
Getting Started with Docker:
Source Code:

Nguồn:https://wijstaanvooronzegrondrechten.org/

Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe

26 COMMENTS

  1. Hello, Tim! Nice video, as usual)) I would like to save the data not just in common log.txt files, but to insert Date in the name of each of these files (something like this: log-01.01.2020.txt). How to set it this line of code correctly: "path": "D:\Logs\log{DATE HERE}.txt"? Thank you!

  2. How would you approach deployment in Azure for a Seq server that is used for multiple environments? Would you deploy it in a docker container or VM? Thank you, great content as always!

  3. Thanks for saving me hours of googling.
    With the right amount of Docker lectures.
    Please do something on docker and docker compose for us probably with graylog installation.
    Thanks

  4. How does seq differ from graylog. Can I use graylog instead of seq to fulfill my requirement of logging in an application?

  5. Hi Tim..I would like to know which is better whether SeriLog or NLog to log asp.net core web application info and error to the SQL server database

  6. I used to use NLog to write errors to text files or database table. After watching this I just upgraded the new application that Im working to Seq with Serilog. I'll be checking out other sinks and stuff because it's so easy the way you explained it just to set up sinks in the appsettings.json file. That's awesome.

  7. Thank for the video. Maybe you could help on a problem im having.
    I have many uses in ILoggerFactory which im using in startup to inject logger to many projects which my main project is using. When removing microsoft logging and only using serilog it doesn`t know ILoggerFactory andi cant compile the project

  8. Fantastic video 🙂 I'm looking at using the extension for SQL so I can use the logs pulled from the DB to present user configurable reports in my project UI (razor pages) using charts.js, hoping this is possible. Another learning curve on the todo list…

  9. Hey, bro. There is a question that when we use WriteTo.File, and we do not shutdown the Kestrel window.How can we open the log file.

  10. If you want to open Visual Studio Code in the current folder in Windows Explorer you don't have to right-click, select "Git Bash Here", open Git console and type "code ." Just under "Git Bash Here" you have "Open with Code". If you right-click on the file, it will open that file in the Code. If you right-click on the empty space of the Windows Explorer, it will open current folder in the Code.

  11. How did you know I was going to need this three days later? Just learned about Serilog/Seq today and BOOM! Tim Corey video.

    EDIT: Question. If I set my Default minimum level to "Warning", can I put an override for my own namespace to be Information? It's not working so I'm curious if that's possible at all.

  12. Thanks for the video.
    But, I can't seem to download the source code. I have tried multiple times with even different browsers, but I am not receiving any email.

LEAVE A REPLY

Please enter your comment!
Please enter your name here