diff --git a/src/Umbraco.PublishedCache.NuCache/ContentStore.cs b/src/Umbraco.PublishedCache.NuCache/ContentStore.cs index 240e6c8861..98fc4a3ffe 100644 --- a/src/Umbraco.PublishedCache.NuCache/ContentStore.cs +++ b/src/Umbraco.PublishedCache.NuCache/ContentStore.cs @@ -608,7 +608,10 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache throw new ArgumentException("Kit content cannot have children.", nameof(kit)); // ReSharper restore LocalizableElement - _logger.LogDebug("Set content ID: {KitNodeId}", kit.Node.Id); + if (_logger.IsEnabled(LogLevel.Debug)) + { + _logger.LogDebug("Set content ID: {KitNodeId}", kit.Node.Id); + } // get existing _contentNodes.TryGetValue(kit.Node.Id, out var link); @@ -727,7 +730,11 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache previousNode = null; // there is no previous sibling } - _logger.LogDebug("Set {thisNodeId} with parent {thisNodeParentContentId}", thisNode.Id, thisNode.ParentContentId); + if (_logger.IsEnabled(LogLevel.Debug)) + { + _logger.LogDebug("Set {thisNodeId} with parent {thisNodeParentContentId}", thisNode.Id, thisNode.ParentContentId); + } + SetValueLocked(_contentNodes, thisNode.Id, thisNode); // if we are initializing from the database source ensure the local db is updated @@ -784,7 +791,12 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache ok = false; continue; // skip that one } - _logger.LogDebug("Set {kitNodeId} with parent {kitNodeParentContentId}", kit.Node.Id, kit.Node.ParentContentId); + + if (_logger.IsEnabled(LogLevel.Debug)) + { + _logger.LogDebug("Set {kitNodeId} with parent {kitNodeParentContentId}", kit.Node.Id, kit.Node.ParentContentId); + } + SetValueLocked(_contentNodes, kit.Node.Id, kit.Node); if (_localDb != null) RegisterChange(kit.Node.Id, kit); @@ -873,7 +885,11 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache if (link?.Value == null) return false; var content = link.Value; - _logger.LogDebug("Clear content ID: {ContentId}", content.Id); + + if (_logger.IsEnabled(LogLevel.Debug)) + { + _logger.LogDebug("Clear content ID: {ContentId}", content.Id); + } // clear the entire branch ClearBranchLocked(content);