7

I've enabled SeriLog (latest version) Self-Logging and am seeing hundreds of messages that say

Maximum destructuring depth reached

No idea what that means and whether it's a problem I need to worry about or not.

Does anyone know what triggers this message and whether I'm doing something wrong?

Mr. T
  • 3,892
  • 3
  • 29
  • 48

1 Answers1

6

From: https://github.com/serilog/serilog/wiki/Structured-Data:

Destructuring is the process of taking a complex .NET object and converting it into a structure, which may later be represented as say, a JSON object or XML blob

Sounds like you might have a ciruclar reference in some data you're logging so when Serilog tries to destructure it, it's running into a recursive loop. Sounds like it has some code to detect this and stop the infinite recursion. I suspect that's where this warning is coming from.

PatrickSteele
  • 14,489
  • 2
  • 51
  • 54
  • 2
    Not entirely sure it was a circular reference, but one of the objects I was adding via an Enricher was the source of the problem. – Mr. T Aug 25 '16 at 20:35
  • Note that it can come from the configuration new LoggerConfiguration().Destructure.ToMaximumDepth(3) – dyesdyes Mar 03 '22 at 09:09
  • 1
    @Mr.T for me, it was the `WithExceptionDetails` enriched causing a recursive logging action. – slasky May 20 '22 at 22:30