From 9d11c76ea12b8aa706e189d425caede28dd0b72d Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Thu, 12 Jun 2025 22:20:44 +0200 Subject: [PATCH] Added start-up logging of document URL caching (#19538) Added startup logging of document URL caching. --- src/Umbraco.Core/Services/DocumentUrlService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Services/DocumentUrlService.cs b/src/Umbraco.Core/Services/DocumentUrlService.cs index c9bc338906..2b60d736cc 100644 --- a/src/Umbraco.Core/Services/DocumentUrlService.cs +++ b/src/Umbraco.Core/Services/DocumentUrlService.cs @@ -141,14 +141,18 @@ public class DocumentUrlService : IDocumentUrlService using ICoreScope scope = _coreScopeProvider.CreateCoreScope(); if (ShouldRebuildUrls()) { - _logger.LogInformation("Rebuilding all URLs."); + _logger.LogInformation("Rebuilding all document URLs."); await RebuildAllUrlsAsync(); } + _logger.LogInformation("Caching document URLs."); + IEnumerable publishedDocumentUrlSegments = _documentUrlRepository.GetAll(); IEnumerable languages = await _languageService.GetAllAsync(); var languageIdToIsoCode = languages.ToDictionary(x => x.Id, x => x.IsoCode); + + int numberOfCachedUrls = 0; foreach (PublishedDocumentUrlSegments publishedDocumentUrlSegment in ConvertToCacheModel(publishedDocumentUrlSegments)) { if (cancellationToken.IsCancellationRequested) @@ -159,9 +163,12 @@ public class DocumentUrlService : IDocumentUrlService if (languageIdToIsoCode.TryGetValue(publishedDocumentUrlSegment.LanguageId, out var isoCode)) { UpdateCache(_coreScopeProvider.Context!, publishedDocumentUrlSegment, isoCode); + numberOfCachedUrls++; } } + _logger.LogInformation("Cached {NumberOfUrls} document URLs.", numberOfCachedUrls); + _isInitialized = true; scope.Complete(); }