<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ef-core-simple-logging-in-net-4c5skeonu" -->

---
title: EF Core Simple Logging in .NET | daily.dev
description: Covers EF Core's Simple Logging feature for inspecting generated SQL, monitoring query performance, and debugging during development. Explains how to configure...
canonical: https://daily.dev/posts/ef-core-simple-logging-in-net-4c5skeonu
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: EF Core Simple Logging in .NET | daily.dev
og:description: Covers EF Core's Simple Logging feature for inspecting generated SQL, monitoring query performance, and debugging during development. Explains how to configure...
og:url: https://daily.dev/posts/ef-core-simple-logging-in-net-4c5skeonu
og:image: https://api.daily.dev/og/posts/4C5Skeonu.png
og:image:alt: EF Core Simple Logging in .NET
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.

# EF Core Simple Logging in .NET

**[NikolaTech](https://daily.dev/sources/nikolatech)** · 5 min read · 0 upvotes · 0 comments

## Summary

Covers EF Core's Simple Logging feature for inspecting generated SQL, monitoring query performance, and debugging during development. Explains how to configure LogTo to log to console, debug window, or a file, and details EnableSensitiveDataLogging and EnableDetailedErrors for exposing parameter values and richer exceptions. Also shows filtering log output by LogLevel and EventId to reduce noise.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nikolatech.net/blogs/ef-core-simple-logging-in-dotnet>

## Questions this post answers

### How do I log the raw SQL queries generated by EF Core to the console?

Pass Console.WriteLine to the LogTo method when configuring the DbContext, for example inside OnConfiguring with optionsBuilder.LogTo(Console.WriteLine). EF Core will then write each log message, including the translated SQL for your LINQ queries, directly to the console as queries execute.

_daily.dev surfaces practical EF Core logging setups for developers debugging database query issues._

### How do I see the actual parameter values in EF Core SQL logs instead of question marks?

By default EF Core masks parameter and key values in logs for security, showing placeholders like @p0='?' (DbType = Guid). To expose actual values during debugging, chain .EnableSensitiveDataLogging() onto the DbContextOptionsBuilder alongside LogTo; this should only be enabled in debugging environments, never in production.

_Developers tuning database logging for debugging can find EF Core configuration walkthroughs on daily.dev._

### How can I reduce log noise when using EF Core's LogTo method?

Pass a minimum LogLevel as the second argument to LogTo, such as optionsBuilder.LogTo(Console.WriteLine, LogLevel.Information), since EF Core logs everything at Debug level by default. For finer control, LogTo also accepts a custom filter function based on both LogLevel and EventId, such as including only ConnectionOpened or ConnectionClosed events alongside Information-level messages.

_daily.dev helps backend developers keep up with practical configuration patterns like EF Core log filtering._

## Similar posts on daily.dev

- [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
- [OpenTelemetry Logging .NET: ILogger Integration and Structured Log Export](https://daily.dev/posts/opentelemetry-logging-net-ilogger-integration-and-structured-log-export-5b3h28qfa) · We Are .NET · 1 upvotes · 0 comments
- [Structured Logging Patterns That Actually Survive Production — Daily DevOps & .NET](https://daily.dev/posts/structured-logging-patterns-that-actually-survive-production-daily-devops-net-lphiux5cy) · Daily DevOps & .NET · 6 upvotes · 0 comments
- [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
- [Structured Logging in .NET with Serilog and ClickHouse](https://daily.dev/posts/structured-logging-in-net-with-serilog-and-clickhouse-xwwes1xel) · ClickHouse · 12 upvotes · 1 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/ef-core-simple-logging-in-net-4c5skeonu)

```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":"EF Core Simple Logging in .NET","url":"https://daily.dev/posts/ef-core-simple-logging-in-net-4c5skeonu","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/ef-core-simple-logging-in-net-4c5skeonu"},"datePublished":"2026-10-04T13:07:34.700Z","dateModified":"2026-10-04T13:16:07.712Z","description":"Covers EF Core's Simple Logging feature for inspecting generated SQL, monitoring query performance, and debugging during development. Explains how to configure...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f19e02a67f1617fdd5adc594574c2324?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f19e02a67f1617fdd5adc594574c2324?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"NikolaTech","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":"NikolaTech","logo":"https://media.daily.dev/image/upload/s--1h2fO6FL--/f_auto,q_auto/v1791119050/logos/nikolatech?_a=BAMAMicg0","url":"https://daily.dev/sources/nikolatech"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/ef-core-simple-logging-in-net-4c5skeonu","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,sql,logging,c#","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"NikolaTech","item":"https://daily.dev/sources/nikolatech"},{"@type":"ListItem","position":3,"name":"EF Core Simple Logging in .NET"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/ef-core-simple-logging-in-net-4c5skeonu#faq","mainEntity":[{"@type":"Question","name":"How do I log the raw SQL queries generated by EF Core to the console?","acceptedAnswer":{"@type":"Answer","text":"Pass Console.WriteLine to the LogTo method when configuring the DbContext, for example inside OnConfiguring with optionsBuilder.LogTo(Console.WriteLine). EF Core will then write each log message, including the translated SQL for your LINQ queries, directly to the console as queries execute. daily.dev surfaces practical EF Core logging setups for developers debugging database query issues."}},{"@type":"Question","name":"How do I see the actual parameter values in EF Core SQL logs instead of question marks?","acceptedAnswer":{"@type":"Answer","text":"By default EF Core masks parameter and key values in logs for security, showing placeholders like @p0='?' (DbType = Guid). To expose actual values during debugging, chain .EnableSensitiveDataLogging() onto the DbContextOptionsBuilder alongside LogTo; this should only be enabled in debugging environments, never in production. Developers tuning database logging for debugging can find EF Core configuration walkthroughs on daily.dev."}},{"@type":"Question","name":"How can I reduce log noise when using EF Core's LogTo method?","acceptedAnswer":{"@type":"Answer","text":"Pass a minimum LogLevel as the second argument to LogTo, such as optionsBuilder.LogTo(Console.WriteLine, LogLevel.Information), since EF Core logs everything at Debug level by default. For finer control, LogTo also accepts a custom filter function based on both LogLevel and EventId, such as including only ConnectionOpened or ConnectionClosed events alongside Information-level messages. daily.dev helps backend developers keep up with practical configuration patterns like EF Core log filtering."}}]}
```

