This is an automated email from the ASF dual-hosted git repository. joerghoh pushed a commit to branch maintenance-2.6.x in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-i18n.git
commit da37ea5ba88fd9b99a402d925d8307cfd1a41d34 Author: Jörg Hoh <[email protected]> AuthorDate: Mon Oct 26 11:55:46 2026 +0100 SLING-13400 limit the amount of paths logged by default (#27) --- .../sling/i18n/impl/JcrResourceBundleProvider.java | 25 ++++++++++++++++++++-- 1 file changed, 23 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..7cb99e1 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,25 @@ 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("Currently loaded {} dictionaries across all locales: {}", total, languageRootPaths); + } + } else { + log.info("Currently loaded dictionaries across all locales: {}", languageRootPaths); + } + } + /** * Creates the resource bundle for the give locale. *
