Serilog and log4net are two very popular choices for logging messages from .NET applications. In this post, I’ll show you how to configure and use each framework as well as list the advantages and disadvantages of each framework. I even dare to recommend you use one of the frameworks :)

Let’s start with a bit of information about each framework.


This is the third part in the series named “Debugging common .NET exceptions”. Today, I want to help you track down and fix a very common and very well known exception, System.IO.FileNotFoundException. Admitted! In all instances, this error is caused by trying to access a file that isn't there. But, there are actually multiple scenarios that can trigger this exception. You may think you know everything there is to know about this exception, but I bet there is something left for you to learn. At least I did while digging down into the details for this post. …

Serilog is often referred to as the new logging framework on the .NET platform, while NLog is considered “the old one” (together with log4net). With Serilog introduced back in 2013 and NLog in 2006, they both have a long history and a great community around them. I have worked with both logging frameworks and in this post, I will try to give you an overview of each framework, the differences, and some recommendations to look for when choosing a logging framework.

Let’s start with a bit of information about each framework.


In my previous post, Individual developer settings in ASP.NET Core, I showed you how to create per-developer settings using Windows environment variables. While environment variables are both fast to produce and script friendly, there is a better approach available in ASP.NET Core called User Secrets.

Unlike environment variables, user secrets are placed in a settings file similar to appsettings.json. Having similar structured off-project settings is great when you need to copy keys and values between files and there is support for adding, removing and listing values as I will show you later in this post.

To understand user secrets, let’s…

Welcome to the second part in the series about debugging common .NET exceptions. The first part can be found here: Debugging: System.Net.WebException — The remote name could not be resolved. The series is my attempt to demystify common exceptions as well as to provide actual help fixing each exception.

In this post, I take a look at one of the more tricky exceptions to fix: System.OutOfMemoryException. As the name suggests, the exception is thrown when a .NET application runs out of memory. There are a lot of blog posts out there, trying to explain why this exception occurs, but most…

So, you started using ASP.NET Core and love the new hierarchical JSON-based settings. But now you realize that you need individual settings per developer on your team. In this post, I will show you the best way to achieve just that.

Let’s start by looking at settings in ASP.NET Core. You may remember <AppSettings> from .NET Full, and luckily, ASP.NET Core (and .NET Core) have a similar construct. In short, you create a new file named appsettings.json and start adding application settings as JSON properties. For the full picture, check out this blog post: AppSettings in ASP.NET Core.

A valid…

This is an extract from my eBook .NET Web Application Logging Essentials. To get your hands on the entire thing, head over to the blog and sign up for the newsletter.

Application Logging

We’ve compiled a list of logging frameworks for .NET. There’s a great deal of options out there, but a lot of them are no longer maintained. The list provided in this section contains the popular choices. Different frameworks support different features, however all frameworks contain a similar API for storing new log messages. Before we start digging into each framework, let’s discuss some common features and terms.

Logging API


How many conferences do you attend each year? Probably not more that one. While great fun, attending conferences is often time-consuming and just the fact that you are not coding scares some bosses away. Luckily, most conferences tape sessions and make them publicly available a month or two after the conference. This is a list of my favorite .NET, C# or Azure related talks that I’ve either experienced live or got recommended by friends.

Solving Diabetes with Open Source Software & Hardware — Scott Hanselman

Scott talks about his personal experiences with technologies related to diabetes (being a diabetic himself). It experienced one of the best iterations on GOTO back in…

ASP.NET Core 2.2 introduces a range of new features. One of the more interesting (IMO) is Health Checks. You may use tools like Pingdom or Uptime Monitoring to ping your website in a specified interval. Pinging a single HTML page may or may not reveal if your application is healthy or not. Health Checks to the rescue! Before trying out the code yourself, make sure to install the recent version of ASP.NET Core 2.2 and Visual Studio 2017. The behavior of health checks has changed from preview to preview.

When developing a new service, I typically define a custom…

Today, I’m happy to share some huge news. is no longer limited to logging errors from your server. We now also support client-side logging through the recent addition, simply named With, JavaScript errors happening right there in the users’ browser, are logged to alongside all of your server-side errors.

As always, we do most of the work for you when needing to install and configure With our focus on the .NET platform, we can make sure that our client-side experience matches the already high standard you know from our server-side integrations. can be installed…

Thomas Ardal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store