From 6ec626db47dc865cf50a07f1d719cfe075be5a1d Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 7 Jun 2011 18:18:06 +0000 Subject: [PATCH] Don't overwhelm logs with TLD scanning messages but make users aware there is room for improvement and tell them how to get at the detail. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1133122 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/jasper/compiler/TldLocationsCache.java | 15 +++++++++++++-- java/org/apache/jasper/resources/LocalStrings.properties | 1 + webapps/docs/changelog.xml | 10 ++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/java/org/apache/jasper/compiler/TldLocationsCache.java b/java/org/apache/jasper/compiler/TldLocationsCache.java index 1258c488a..3c8539522 100644 --- a/java/org/apache/jasper/compiler/TldLocationsCache.java +++ b/java/org/apache/jasper/compiler/TldLocationsCache.java @@ -96,6 +96,10 @@ public class TldLocationsCache { // Names of JARs that are known not to contain any TLDs private static Set noTldJars = null; + // Flag that indicates that an INFO level message has been provided that + // there are JARs that could be skipped + private static volatile boolean showTldScanWarning = true; + /** * The mapping of the 'global' tag library URI to the location (resource * path) of the TLD associated with that tag library. The location is @@ -438,8 +442,15 @@ public class TldLocationsCache { } if (!foundTld) { - log.info(Localizer.getMessage("jsp.tldCache.noTldInJar", - resourcePath)); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.tldCache.noTldInJar", + resourcePath)); + } else if (showTldScanWarning) { + // Not entirely thread-safe but a few duplicate log messages are + // not a huge issue + showTldScanWarning = true; + log.info(Localizer.getMessage("jsp.tldCache.noTldSummary")); + } } } diff --git a/java/org/apache/jasper/resources/LocalStrings.properties b/java/org/apache/jasper/resources/LocalStrings.properties index 74569c61e..3939af660 100644 --- a/java/org/apache/jasper/resources/LocalStrings.properties +++ b/java/org/apache/jasper/resources/LocalStrings.properties @@ -491,3 +491,4 @@ jsp.message.jsp_unload_check=Checking JSPs for unload in context [{0}], JSP coun xmlParser.skipBomFail=Failed to skip BOM when parsing XML input stream jsp.tldCache.noTldInJar=No TLD files were found in [{0}]. Consider adding the JAR to to the tomcat.util.scan.DefaultJarScanner.jarsToSkip in CATALINA_BASE/catalina.properties +jsp.tldCache.noTldSummary=At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned where no TLDs were found. Skipping JAR scanning can improve startup time and JSP compilation time. \ No newline at end of file diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 786fa8b55..65ffe5269 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -60,6 +60,16 @@ + + + + Change JAR scanning log messages where no TLDs are found to DEBUG level + and replace the multiple messages with a single INFO level message that + indicates that at least one JAR was scanned needlessly and how to obtain + more info. (markt) + + + -- 2.11.0