LOG4J2-2789 - Conditionally perform status logging calculations in PluginRegistry.
diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/util/PluginRegistry.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/util/PluginRegistry.java
index f18fd1e..344b987 100644
--- a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/util/PluginRegistry.java
+++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/util/PluginRegistry.java
@@ -210,11 +210,16 @@
                 }
             }
         }
-        final long endTime = System.nanoTime();
-        final DecimalFormat numFormat = new DecimalFormat("#0.000000");
-        final double seconds = (endTime - startTime) * 1e-9;
-        LOGGER.debug("Took {} seconds to load {} plugins from {}",
-                numFormat.format(seconds), pluginCount, classLoader);
+        final int numPlugins = pluginCount;
+        LOGGER.debug(() -> {
+            final long endTime = System.nanoTime();
+            StringBuilder sb = new StringBuilder("Took ");
+            final DecimalFormat numFormat = new DecimalFormat("#0.000000");
+            sb.append(numFormat.format((endTime - startTime) * 1e-9));
+            sb.append(" seconds to load ").append(numPlugins);
+            sb.append(" plugins from ").append(classLoader);
+            return sb.toString();
+        });
     }
 
     private Map<String, List<PluginType<?>>> decodeCacheFiles(final ClassLoader loader) {
@@ -251,12 +256,16 @@
                 }
             }
         }
-
-        final long endTime = System.nanoTime();
-        final DecimalFormat numFormat = new DecimalFormat("#0.000000");
-        final double seconds = (endTime - startTime) * 1e-9;
-        LOGGER.debug("Took {} seconds to load {} plugins from {}",
-            numFormat.format(seconds), pluginCount, loader);
+        final int numPlugins = pluginCount;
+        LOGGER.debug(() -> {
+            final long endTime = System.nanoTime();
+            StringBuilder sb = new StringBuilder("Took ");
+            final DecimalFormat numFormat = new DecimalFormat("#0.000000");
+            sb.append(numFormat.format((endTime - startTime) * 1e-9));
+            sb.append(" seconds to load ").append(numPlugins);
+            sb.append(" plugins from ").append(loader);
+            return sb.toString();
+        });
         return newPluginsByCategory;
     }
 
@@ -318,12 +327,15 @@
                 }
             }
         }
-
-        final long endTime = System.nanoTime();
-        final DecimalFormat numFormat = new DecimalFormat("#0.000000");
-        final double seconds = (endTime - startTime) * 1e-9;
-        LOGGER.debug("Took {} seconds to load {} plugins from package {}",
-            numFormat.format(seconds), resolver.getClasses().size(), pkg);
+        LOGGER.debug(() -> {
+            final long endTime = System.nanoTime();
+            StringBuilder sb = new StringBuilder("Took ");
+            final DecimalFormat numFormat = new DecimalFormat("#0.000000");
+            sb.append(numFormat.format((endTime - startTime) * 1e-9));
+            sb.append(" seconds to load ").append(resolver.getClasses().size());
+            sb.append(" plugins from package ").append(pkg);
+            return sb.toString();
+        });
 
         // Note multiple threads could be calling this method concurrently. Both will do the work,
         // but only one will be allowed to store the result in the outer map.
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 3c9f7ae..e2999d2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -166,6 +166,9 @@
       </action>
     </release>
     <release version="2.13.1" date="2019-MM-DD" description="GA Release 2.13.1">
+      <action issue="LOG4J2-2789" dev="rgeors" type="update" due-to="Marius Volkhart">
+        Conditionally perform status logging calculations in PluginRegistry.
+      </action>
       <action issue="LOG4J2-2756" dev="rgoers" type="fix">
         Prevent LoggerContext from being garbage collected while being created.
       </action>