Skip to main content

14 posts tagged with "Logging"

Logging Practices and Tools for Applications

View All Tags

Fixed: "error CA1848: For improved performance, use the LoggerMessage delegates" in .NET

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

The most ordinary line of logging you can write, logger.LogInformation("Counted {Count} products", count), stopped my build: error CA1848: For improved performance, use the LoggerMessage delegates instead of calling 'LoggerExtensions.LogInformation'. The solution turns analyzer warnings into errors, so this rule has teeth. The fix is the [LoggerMessage] source generator, which is a few lines more and gives you faster logging.

How to See the SQL That EF Core Sends to the Database in an ASP.NET Core App (Logging)

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

When an EF Core query is slow or a save fails, the first question is: what SQL did it actually send? In an ASP.NET Core app you usually don't need to add anything to find out: EF Core already writes every command to the log. This guide shows where it appears, how to turn it down when it's too noisy, and how to see the parameter values, carefully.

How to See the Logs of a Docker Compose Service (docker compose logs)

· 11 min read
Jagdish Kumawat
Founder @ Dewiride

When a container misbehaves, the first thing to read is what it printed. docker compose logs shows that output for any service in your compose.yaml: all of it, the last few lines, only the last few minutes, or live as it happens. This guide runs each option against a real MySQL 9.7 container and explains what you're looking at.

Fix: ILogger Type Mismatch in AdapterWithErrorHandler CloudAdapter

· 2 min read
Jagdish Kumawat
Founder @ Dewiride

When creating an AdapterWithErrorHandler class that inherits from CloudAdapter, you might encounter this compile error:

Argument 3: cannot convert from 'Microsoft.Extensions.Logging.ILogger<Microsoft.Agents.Hosting.AspNetCore.IAgentHttpAdapter>' to 'Microsoft.Extensions.Logging.ILogger<Microsoft.Agents.Hosting.AspNetCore.CloudAdapter>'

This happens because you're passing ILogger<IAgentHttpAdapter> to the CloudAdapter base constructor, but it expects ILogger<CloudAdapter>.