Urgent.News

What's breaking now, across thousands of outlets.

Tech

.NET 10 JSON Console Logging: Stop Parsing State.Message

The .NET 10 JSON console logging change is small enough to miss during an upgrade: the formatted message still exists, but a typical record no longer duplicates it at State.Message . A collector, script, or snapshot test that reads only that nested property can start returning null while the application continues logging normally. I treat console JSON as a schema whenever another process parses…

With the transition to .NET 10, a subtle change has been introduced in JSON console logging that could break certain parsers. Previously, the formatted message was duplicated in the State.Message property. However, in the current version, the formatted message resides at the top-level Message property, while State now holds structured values.

This change may cause applications that solely rely on parsing State.Message to return null values after an upgrade, even though logging continues normally. To prevent such issues, it's recommended to treat console JSON as a schema and perform contract testing, rather than just a visual check. The practical solution involves reading the top-level Message property and retaining State for structured data, while using a narrow fallback for older records.

By focusing on the top-level Message and keeping State structured, parsers can avoid issues caused by duplicated messages. The official documentation advises parsers to use the top-level Message property, acknowledging that State.Message might still appear but with potentially different content. While this change doesn't result in a loss of structured logging data, it's essential to adapt parsers accordingly.

One approach is to create a top-level-first rule that prioritizes the top-level Message and falls back to State.Message when necessary. This way, the canonical message remains consistent across different versions. Additionally, the structured properties inside State can be parsed separately, as they still provide valuable information for grouping or diagnostics.

To ensure the integrity of the logging output, it's recommended to create an offline regression test that captures a documented legacy fixture, a real .NET 10 emitter, and a verifier. The verifier can launch the emitter, capture the JSON line, and verify the semantics without relying on a specific logging backend or external services.

This test can catch more realistic failures than relying on hand-authored strings, as it verifies the presence of the top-level message, absence of redundant nested messages, and the integrity of structured values.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

AWS EC2 Deployment — Q&A Reference

A reference guide compiled from deploying two Node.js/Docker apps to AWS EC2, covering the real issues hit and how they were fixed. 1. Getting Connected Q: How do I SSH into my EC2 instance?

  • Use chmod 400 and ssh command to access EC2 instance
  • Verify connected instance via curl commands for ID and public IP
  • Allocate Elastic IP for stable public IP and HTTPS setup

How I turned Linear into a customer-facing roadmap without adding client seats

I built Feedvote because I kept running into a simple product problem: our team wanted to keep planning in Linear, but customers and stakeholders needed a much narrower view of what was happening.

  • Linear roadmap projected as controlled system, not additional client seats
  • Internal Linear system separate from public customer portal
  • Feedback and votes moderated before becoming Linear work

Ruby Pathname Moved to Core, Documentation Upgraded

In release 4.0, the Ruby Powers-That-Be have brought class Pathname into the Ruby core. This is a Very Good Thing. Through its many instance methods, a Pathname object provides a consistent and…

  • Pathname class integrated into Ruby core in version 4.0
  • Documentation for Pathname methods upgraded with local descriptions and examples
  • Updated documentation released with Ruby 4.1 later this year

More from Saturday 22 August →