From dbe9b5c6dc1b73dca50ce9fc27d4b331a019b7c7 Mon Sep 17 00:00:00 2001 From: Rebeca Gallardo Date: Mon, 30 Oct 2023 13:32:26 -0700 Subject: [PATCH] More verbose logging with instructions for users. --- .../java/com/netflix/archaius/ConfigProxyFactory.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/archaius2-core/src/main/java/com/netflix/archaius/ConfigProxyFactory.java b/archaius2-core/src/main/java/com/netflix/archaius/ConfigProxyFactory.java index 398b0c61..8e669232 100644 --- a/archaius2-core/src/main/java/com/netflix/archaius/ConfigProxyFactory.java +++ b/archaius2-core/src/main/java/com/netflix/archaius/ConfigProxyFactory.java @@ -494,8 +494,13 @@ private static void warnWhenTooMany(Map counters, T countKey, in currentCount >= limit && (currentCount % limit == 0 )) { - LOG.warn("Too many {} objects are being created. Please review the calling code to prevent memory leaks. Stack trace for debugging follows:", - objectDescription.get(), new Throwable()); + LOG.warn( + "Too many {} objects are being created ({} so far).\n" + + "Please review the calling code to prevent memory leaks.\n" + + "Normal usage for ConfigProxyFactory is to create singletons via your DI mechanism.\n" + + "For special use cases that *require* creating multiple instances you can tune reporting\n" + + "by setting the `{}` config key to a higher threshold.\nStack trace for debugging follows:", + objectDescription.get(), currentCount, EXCESSIVE_PROXIES_LIMIT, new Throwable()); } }