This is an automated email from the ASF dual-hosted git repository. joerghoh pushed a commit to branch SLING-13400 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-i18n.git
commit 42de5ba6b55cd53dda77c06929325c0bd02a80a8 Author: Joerg Hoh <[email protected]> AuthorDate: Sun Oct 25 11:21:44 2026 +0100 SLING-13400 limit the amount of paths logged by default --- .../sling/i18n/impl/JcrResourceBundleProvider.java | 29 ++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java b/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java index 2fd8d96..c84e50b 100644 --- a/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java +++ b/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java @@ -93,7 +93,9 @@ public class JcrResourceBundleProvider implements ResourceBundleProvider, ResourceChangeListener, ExternalResourceChangeListener { /** default log */ - private final Logger log = LoggerFactory.getLogger(getClass()); + private static final Logger log = LoggerFactory.getLogger(JcrResourceBundleProvider.class); + + private static final int MAX_LANGUAGE_ROOT_PATHS_AT_INFO = 100; /** * A regular expression pattern matching all custom country codes. @@ -524,7 +526,7 @@ public class JcrResourceBundleProvider this.languageRootPaths.addAll(languageRoots); log.debug("Key {} - added service registration and language roots {}", key, languageRoots); - log.info("Currently loaded dictionaries across all locales: {}", languageRootPaths); + logLanguageRootPaths(languageRootPaths); } catch (final LoginException le) { throw (MissingResourceException) new MissingResourceException( @@ -546,6 +548,29 @@ public class JcrResourceBundleProvider return resourceBundle; } + private static void logLanguageRootPaths(Set<String> languageRootPaths) { + final int total = languageRootPaths.size(); + if (total > MAX_LANGUAGE_ROOT_PATHS_AT_INFO) { + if (log.isInfoEnabled()) { + log.info( + "Currently loaded dictionaries across all locales: {} (... and {} more, enable DEBUG logging to see them)", + languageRootPaths.stream() + .limit(MAX_LANGUAGE_ROOT_PATHS_AT_INFO) + .collect(Collectors.toList()), + total - MAX_LANGUAGE_ROOT_PATHS_AT_INFO); + } + if (log.isDebugEnabled()) { + log.debug( + "Remaining loaded dictionaries across all locales: {}", + languageRootPaths.stream() + .skip(MAX_LANGUAGE_ROOT_PATHS_AT_INFO) + .collect(Collectors.toList())); + } + } else { + log.info("Currently loaded dictionaries across all locales: {}", languageRootPaths); + } + } + /** * Creates the resource bundle for the give locale. *
