# How to turn on log enrichment while maintaining json format in .NET?

**URL:** <https://community.dynatrace.com/t/how-to-turn-on-log-enrichment-while-maintaining-json-format-in-net/55938>\
**Category:** Logs\
**Tags:** log-configuration, dotnet, logs\
**Created:** [May 18, 2026, 11:21pm UTC](https://community.dynatrace.com/t/how-to-turn-on-log-enrichment-while-maintaining-json-format-in-net/55938 "2026-05-18T23:21:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShaoHungYu](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@ShaoHungYu](https://community.dynatrace.com/u/ShaoHungYu)\
**Post date:** [May 18, 2026, 11:21pm UTC](https://community.dynatrace.com/t/how-to-turn-on-log-enrichment-while-maintaining-json-format-in-net/55938/1 "2026-05-18T23:21:48Z")

</div>

We have one agent installed in our Azure .NET web app, in the app service console log, the result description is in perfect json format.

I went to One Agent settings and turned these on

.NET - Trace/span context enrichment for logs [Opt-In]  
.NET - Trace/span context enrichment for unstructured logs [Opt-In]  
.NET - Trace/span context enrichment Framework Microsoft Logging Extensions

I can then see&nbsp;[!dt trace\_id=,span\_id=,trace\_sampled=true] being added in my result description. Now my log has trace id and span id, but it is no longer a json format.

I experimented a little, like leave only&nbsp;.NET - Trace/span context enrichment for logs [Opt-In] on, I can see my log goes back to json format, but there is no trace id or span id injected.

Anyone faced the same issue before?
