Home / Companies / Sonar / Blog / Post Details
Content Deep Dive

C# Logging Best Practices with .NET

Blog post from Sonar

Post Details
Company
Date Published
Author
Denis Troller
Word Count
2,561
Company Posts That Month
9
Language
English
Hacker News Points
-
Post removed?
No
Summary

Logging is an essential part of application development and is often overlooked. It's like an airplane's black box that helps developers understand what went wrong when something goes awry in the app. Despite its importance, logging is frequently treated as an afterthought, implemented without proper planning or understanding. Poor logging can lead to difficulties in diagnosing issues in production and hinder search capabilities of a logging backend. Sonar provides C# logging rules that help developers avoid making mistakes when logging required information. These rules cover various aspects such as message syntax and semantics, placeholder duplication, order of placeholders, manual crafting of messages, using the wrong overload, wrong logger category, unlogged exception, conventions, and consistency. Sonar also provides recommendations for setting conventions to help relieve the brain of information overload and make the code base easier to understand. Additionally, it offers guidance on performance and log file considerations, such as avoiding too much logging that can lead to performance degradation or log file overload.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Observability 4 1,227 261 93 -15%
OpenTelemetry 3 370 47 21 -50%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.