diff --git a/src/Serilog/Configuration/LoggerDestructuringConfiguration.cs b/src/Serilog/Configuration/LoggerDestructuringConfiguration.cs index 1decf8275..164b76cea 100644 --- a/src/Serilog/Configuration/LoggerDestructuringConfiguration.cs +++ b/src/Serilog/Configuration/LoggerDestructuringConfiguration.cs @@ -137,9 +137,9 @@ public LoggerConfiguration ByTransforming(Func transform } /// - /// When destructuring objects, depth will be limited to 5 property traversals deep to + /// When destructuring objects, depth will be limited to 10 property traversals deep to /// guard against ballooning space when recursive/cyclic structures are accidentally passed. To - /// increase this limit pass a higher value. + /// change this limit pass a new maximum depth. /// /// The maximum depth to use. /// Configuration object allowing method chaining. diff --git a/test/Serilog.Tests/LoggerConfigurationTests.cs b/test/Serilog.Tests/LoggerConfigurationTests.cs index 3f32a836c..e4e863053 100644 --- a/test/Serilog.Tests/LoggerConfigurationTests.cs +++ b/test/Serilog.Tests/LoggerConfigurationTests.cs @@ -262,6 +262,35 @@ public void EnrichersExecuteInConfigurationOrder() Assert.True(enrichedPropertySeen); } + [Fact] + public void MaximumDestructuringDepthDefaultIsEffective() + { + var x = new + { + Lvl01 = new + { + Lvl02 = new + { + Lvl03 = new + { + Lvl04 = new + { + Lvl05 = new + { + Lvl06 = new { Lvl07 = new { Lvl08 = new { Lvl09 = new { Lvl10 = "Lvl11" } } } } + } + } + } + } + } + }; + + var xs = LogAndGetAsString(x, conf => conf, "@"); + + Assert.Contains("Lvl10", xs); + Assert.DoesNotContain("Lvl11", xs); + } + [Fact] public void MaximumDestructuringDepthIsEffective() {