.NET 4 Logging Done Right: An Opinionated Approach Using Serilog 2
Establish a great logging framework for all of your applications using Serilog as a foundation, then get them written to database sinks (SQL Server and Elasticsearch specifically), and explore log data using custom and in-the-box tools.
What you'll learn
Establishing a foundational framework for logging can save hours in troubleshooting and provide valuable insights to both utilization and performance within all of your applications.
In this course, .NET Logging Done Right: An Opinionated Approach Using Serilog, you will learn about 4 primary "things" (usage, performance, errors, and diagnostics) to log and how to log them. You will also learn how to globally write these log entries without needing to inject logging code everywhere in an application – so developers can focus on business logic, not logging code.
Global logging will be shown with all flavors of
- ASP.NET
- WPF applications
- WCF services, and
- TypeScript/JavaScript applications
By the end this course, you’ll know how to create a great logging framework that will provide huge benefits to you and many other people who have a stake in your applications
Table of contents
- Introduction: What to Log and How to Log It 5m
- Create the Global Logger 4m
- Add a Performance Tracker 2m
- Logging with a Console App 6m
- Discussion: Exception Handling and Data Access 1m
- Data Access Before Custom Exception Handling 4m
- Create an ADO.NET Stored Procedure Wrapper 2m
- Create a Dapper Extension Method 1m
- Create an Entity Framework Command Interceptor 2m
- Verifying the Custom Data Access Exception Handling 4m
- Add the Procedure Name and Exception Method to Top Level of Log Entry 2m
- Summary 0m
- Introduction 4m
- Demo Approach 2m
- MVC App: Running the Existing Code 2m
- MVC App: Existing Code Walkthrough 6m
- API: Running the Existing Code 2m
- API: Existing Code Walkthrough 4m
- Building the Utility Logging Code 7m
- Ad-hoc Usage and Diagnostic Logging 6m
- Filter-based Performance Logging 6m
- MVC Exception Logging with Middleware 5m
- API Exception Logging with Middleware 5m
- Summary 1m
- Logging Goals and Sink Options 9m
- Writing to a SQL Server Sink and Verifying Entries 8m
- Using a Custom Web Viewer to Review Log Entries 5m
- Using an SSRS Report as a Dashboard of Sorts 2m
- ELK Stack Intro and Hosting It in a Docker Image 5m
- Writing to an Elasticsearch and Verifying Entries 4m
- Configuring Index Patterns with Kibana 1m
- Log 'Discovery' with Kibana 4m
- Log 'Visualization' and 'Dashboards' with Kibana 9m
- Changing an Analyzed Field in Kibana 3m
- Summary 2m
Course FAQ
Serilog is a logging framework integrated with .NET applications for recording diagnostic logs into files and SQL/NoSQL databases
Some of the benefits of Serilog include:
- diagnostic logging into files, console, and elsewhere
- Easy to set up
- Clean API
- Portable between .NET platforms
- Powerful structured event data
In this course you will learn about:
- An introduction to Serilog
- Goals of good logging
- What to log and how to log it
- Global Logging in ASP.NET MVC and web forms
- Global Logging in JavaScript/TypeScript
- Global Logging in ASP.NET Core
- Global Logging with WPF and WCF
- Usage, performance, errors, and diagnostics
- Search, explore, and visualize log entries
- Much more
This course is intended for those who want to learn Serilog and its approach to .NET Logging. Especially useful for people who want to minimize situations where they have to reproduce problems in their applications or jump on escalated issues to troubleshoot.
This is an intermediate level course, so it assumes some previous exposure to working with application development, including troubleshooting and fixing issues in applications. Familiarity with ASP.NET, MVC, Web forms, JavaScript, WPF and WCF will come in handy.