<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/blazor-basics-introduction-to-logging-with-serilog-in-blazor-applications-secinqyjh" -->

---
title: Blazor Basics: Introduction to Logging with Serilog in...
description: This tutorial shows how to add Serilog logging to Blazor Server and Blazor WebAssembly apps. For Blazor Server, you install the Serilog.AspNetCore NuGet...
canonical: https://daily.dev/posts/blazor-basics-introduction-to-logging-with-serilog-in-blazor-applications-secinqyjh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Blazor Basics: Introduction to Logging with Serilog in Blazor Applications | daily.dev
og:description: This tutorial shows how to add Serilog logging to Blazor Server and Blazor WebAssembly apps. For Blazor Server, you install the Serilog.AspNetCore NuGet...
og:url: https://daily.dev/posts/blazor-basics-introduction-to-logging-with-serilog-in-blazor-applications-secinqyjh
og:image: https://api.daily.dev/og/posts/seCINqyjH.png
og:image:alt: Blazor Basics: Introduction to Logging with Serilog in Blazor Applications
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Blazor Basics: Introduction to Logging with Serilog in Blazor Applications

**[Telerik](https://daily.dev/sources/telerik)** · 7 min read · 0 upvotes · 0 comments

## Summary

This tutorial shows how to add Serilog logging to Blazor Server and Blazor WebAssembly apps. For Blazor Server, you install the Serilog.AspNetCore NuGet package, configure it in Program.cs with Console and File sinks, and inject ILogger into components like Counter.razor. For Blazor WebAssembly, the same package won't work because it depends on the ASP.NET Core shared runtime, which is incompatible with the browser runtime. Instead, WebAssembly apps log to the browser console or send logs to a remote API. Serilog has over 80 available sinks, including advanced ones such as those for Azure Storage.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.telerik.com/blogs/blazor-basics-introduction-logging-serilog>

## Questions this post answers

### Can I use the Serilog.AspNetCore NuGet package in a Blazor WebAssembly project?

No. The Serilog.AspNetCore package depends on the ASP.NET Core shared runtime, which is incompatible with the browser WebAssembly runtime. For Blazor WebAssembly client projects, you instead configure Serilog to log to the browser console, or send log messages to a remote API endpoint for centralized storage on a server.

_Developers architecting Blazor WebAssembly logging can compare setup approaches on daily.dev._

### How do I set up Serilog logging in a Blazor Server app's Program.cs file?

Install the Serilog.AspNetCore NuGet package, then use the AddSerilog extension method on IServiceCollection to configure it. Set the minimum log level, for example to Information, and use the WriteTo property to add Console and File sinks, with the file configured to include the current day in its filename for automatic daily log splitting.

_Developers wiring up Blazor logging can track setup patterns like this one on daily.dev._

### How many logging sinks does Serilog support?

Serilog has over 80 sinks listed in its official repository, including common targets like Console and File as well as more advanced ones such as Azure Storage blob storage. Sinks specify where or how log information is stored, and which ones are active can be configured at runtime via appsettings.json rather than hardcoded in source.

_Developers picking a logging target for production can track Serilog sink options on daily.dev._

## Similar posts on daily.dev

- [Serilog Sinks: Console, File, Seq, and More](https://daily.dev/posts/serilog-sinks-console-file-seq-and-more-k2dux4zvo) · We Are .NET · 2 upvotes · 0 comments
- [Beyond Console.WriteLine: Mastering Structured Logging in .NET](https://daily.dev/posts/beyond-console-writeline-mastering-structured-logging-in-net-hgcoz2ses) · ITNEXT · 10 upvotes · 0 comments
- [Tuning the default logging providers in ASP.NET Core through configuration](https://daily.dev/posts/tuning-the-default-logging-providers-in-asp-net-core-through-configuration-fjejxdftp) · The Art of Simplicity · 0 upvotes · 0 comments
- [Blazor Basics: Getting Started with Blazor Development in VS Code](https://daily.dev/posts/blazor-basics-getting-started-with-blazor-development-in-vs-code-kjcp0o6dg) · Telerik · 1 upvotes · 0 comments

---

Tags: [#.net](https://daily.dev/tags/.net), [#logging](https://daily.dev/tags/logging), [#webassembly](https://daily.dev/tags/webassembly), [#blazor](https://daily.dev/tags/blazor)

[View this post on daily.dev](https://daily.dev/posts/blazor-basics-introduction-to-logging-with-serilog-in-blazor-applications-secinqyjh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Blazor Basics: Introduction to Logging with Serilog in Blazor Applications","url":"https://daily.dev/posts/blazor-basics-introduction-to-logging-with-serilog-in-blazor-applications-secinqyjh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/blazor-basics-introduction-to-logging-with-serilog-in-blazor-applications-secinqyjh"},"datePublished":"2026-10-27T15:33:23.230Z","dateModified":"2026-10-27T15:41:59.693Z","description":"This tutorial shows how to add Serilog logging to Blazor Server and Blazor WebAssembly apps. For Blazor Server, you install the Serilog.AspNetCore NuGet...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/88d1b6544e7d41f44a8a1a3d54f13fe5?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/88d1b6544e7d41f44a8a1a3d54f13fe5?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Telerik","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Telerik","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/5ee6d4bef8ac4f84886d06f5881963e7","url":"https://daily.dev/sources/telerik"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/blazor-basics-introduction-to-logging-with-serilog-in-blazor-applications-secinqyjh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,logging,webassembly,blazor","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Telerik","item":"https://daily.dev/sources/telerik"},{"@type":"ListItem","position":3,"name":"Blazor Basics: Introduction to Logging with Serilog in Blazor Applications"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/blazor-basics-introduction-to-logging-with-serilog-in-blazor-applications-secinqyjh#faq","mainEntity":[{"@type":"Question","name":"Can I use the Serilog.AspNetCore NuGet package in a Blazor WebAssembly project?","acceptedAnswer":{"@type":"Answer","text":"No. The Serilog.AspNetCore package depends on the ASP.NET Core shared runtime, which is incompatible with the browser WebAssembly runtime. For Blazor WebAssembly client projects, you instead configure Serilog to log to the browser console, or send log messages to a remote API endpoint for centralized storage on a server. Developers architecting Blazor WebAssembly logging can compare setup approaches on daily.dev."}},{"@type":"Question","name":"How do I set up Serilog logging in a Blazor Server app's Program.cs file?","acceptedAnswer":{"@type":"Answer","text":"Install the Serilog.AspNetCore NuGet package, then use the AddSerilog extension method on IServiceCollection to configure it. Set the minimum log level, for example to Information, and use the WriteTo property to add Console and File sinks, with the file configured to include the current day in its filename for automatic daily log splitting. Developers wiring up Blazor logging can track setup patterns like this one on daily.dev."}},{"@type":"Question","name":"How many logging sinks does Serilog support?","acceptedAnswer":{"@type":"Answer","text":"Serilog has over 80 sinks listed in its official repository, including common targets like Console and File as well as more advanced ones such as Azure Storage blob storage. Sinks specify where or how log information is stored, and which ones are active can be configured at runtime via appsettings.json rather than hardcoded in source. Developers picking a logging target for production can track Serilog sink options on daily.dev."}}]}
```

