Log Management and Analytics

Explore the full capabilities of Log Management and Analytics powered by SolarWinds Loggly

View Product Info


Infrastructure Monitoring Powered by SolarWinds AppOptics

Instant visibility into servers, virtual hosts, and containerized environments

View Infrastructure Monitoring Info

Application Performance Monitoring Powered by SolarWinds AppOptics

Comprehensive, full-stack visibility, and troubleshooting

View Application Performance Monitoring Info

Digital Experience Monitoring Powered by SolarWinds Pingdom

Make your websites faster and more reliable with easy-to-use web performance and digital experience monitoring

View Digital Experience Monitoring Info

Blog Development

Getting the Most out of .NET8 with Loggly

By Loggly Team 25 Jun 2024

Microsoft’s .NET 8 was released on November 14, 2023, and will be supported for three years as the latest Long Term Support release of .NET. From significant performance gains to simplified orchestration of distributed applications, .NET 8 has something for every user of .NET.

In this article, we’ll cover the highlights of .NET 8 and walk through a sample of .NET Aspire. Let’s begin with an always-welcome guest: improved performance.

Performance Improvements

.NET 8 has focused heavily on improving performance. Here is a small selection of the improvements made:

Dynamic Profile-Guided Optimization

Dynamic Profile-Guided Optimization (PGO) is now enabled by default. This improvement to the just-in-time (JIT) compiler allows the compiler to essentially generate an unoptimized version of the code with instrumentation. This instrumentation is then used to generate an optimized version of the compiled code. This allows for significant compiler optimizations to occur while still allowing for quick startup using the unoptimized code. In an example where the optimization devirtualizes a virtual function call, the results are significant:


Collections also have several performance improvements. One example is that the built-in types now return empty singleton enumerators instead of allocating a new object, saving time and memory.

Another Collections improvement is to the AddRange function, which now calls Add instead of InsertRange, with significant performance improvements.


Logging overhead has been improved as well. The CreateLogger method has been optimized using ConcurrentDictionary<TKey, TValue>, reducing the need for lock usage. Here are the general results:

We’ll look at logging more in the .NET Aspire section further down.

For more on .NET 8 performance improvements, check out the Microsoft dev blog, where Stephen Taub details more than 500 PRs that contributed to performance improvements in .NET 8.

JSON Serialization and Deserialization

System.Text.Json has seen significant requested updates, especially for Native Ahead-Of-Time (AOT) applications. Here are a few highlights:

  1. .NET 8 has first-class support for System.Text.Json usage inside Native AOT applications. This includes required and init member support, unspeakable type support, disabling reflection defaults, and size reduction.
  2. The new generic JsonStringEnumConverter<TEnum> class does not require run-time code generation and can be used inside Native AOT applications.
  3. Built-in support for Memory<T> and ReadOnlyMemory<T>.
  4. Numerous bug fixes and performance enhancements.

For more on System.Text.Json updates, see the Microsoft dev blog on System.Text.Json updates.

Randomness APIs

In a small but meaningful update, new randomness APIs make adding randomness to your applications, including your AI/machine learning pipelines, easier than ever. System.Random.GetItems() and System.Random.Shuffle() allow you to easily select a random subset of items or randomize the order of an array.

.NET Aspire

.NET Aspire is a new stack for distributed, cloud-native applications built with . .NET. .NET Aspire is designed to help with orchestration, standard components, and tooling. Let’s build a quick .NET Aspire app and see what it’s all about.


First, you will need to install .NET 8.0. Next, you will need to install the .NET Aspire workload. We can do this with the .NET CLI by running the following command:

dotnet workload install aspire

To host your containers, you will need a container runtime. We’ll use Docker Desktop.

Create a starter project

Create a folder for your project. In that folder, run the following command:

dotnet new aspire-starter --use-redis-cache --output AspireSample

Understanding .NET Aspire

Look in your solution folder. You will see four main components.

Let’s briefly walk through what each of these sections handles:

  1. <project>.ApiService: A basic API that provides data to the front end. This API depends on the .ServiceDefaults project below.
  2. <project>.AppHost: An orchestrator that connects and configures the other projects and services in your app. This is the startup project.
  3. <project>.ServiceDefaults: This .NET Aspire project manages reusable configurations across your projects, giving them shared resilience, service discovery, and telemetry configurations.
  4. <project>.Web: This Blazor app is the front end for this sample project. Similar to the .ApiService project, this also depends on the .ServiceDefaults project.

Within the front end, we see several available monitoring tools. When we click on Console in the sidebar, we see console logs for the various pieces:

This also includes the Redis cache running in Docker:

We can also see a centralized logging setup across the orchestrated resources. Click Structured in the sidebar navigation:

OpenTelemetry and other metrics are also available under Metrics:

.NET Aspire provides high-level orchestration and telemetry for single projects with multiple services and pieces. We can use SolarWinds® Loggly® for centralized log management of complex, heterogeneous systems with various projects and applications.

Centralized Logging with Loggly

Loggly can ingest logs from a wide variety of sources. We’ll set up the Windows event log as our source via Nxlog.

First, sign up for a free trial of Loggly.

Next, in your Loggly portal, go to Logs > Source Setup > Nxlog.

Download and install Nxlog Community Edition. After installation, open C:\Program Files\nxlog\conf\nxlog.conf in an Administrator window. Replace the configuration file’s contents with the configuration file provided by Loggly.

In nxlog.conf, make sure to check the nxlog installation location. If you are on a 64-bit system, uncomment the first ROOT and ROOT_STRING lines and comment the latter ones.

Save your configuration file. Then, open up services.msc and restart the nxlog service:

You have now set up your Windows source. Head back to your dashboard and check out your centralized logs.

Loggly also makes it easy to search your logs. For example, we can search for everything which has “Error”:

There is much more to .NET Aspire and Loggly than we can cover in this article. For more, check out the .NET Aspire and Loggly docs.

Wrap up

With significant performance improvements and updates in many areas, .NET 8 is already having a positive impact on the .NET ecosystem. For more on .NET 8, check out the Microsoft Learn post.

Loggly can help you unify and centralize your logs, not only for your .Net 8 applications but across all your applications and infrastructure. When you’re ready to get started with Loggly, sign up for a free account today!

The Loggly and SolarWinds trademarks, service marks, and logos are the exclusive property of SolarWinds Worldwide, LLC or its affiliates. All other trademarks are the property of their respective owners.
Loggly Team

Loggly Team