geirm 01/05/20 14:40:40
Modified: src/java/org/apache/velocity/runtime RuntimeConstants.java
src/java/org/apache/velocity/runtime/resource
ResourceManager.java
Log:
Added switch to shut off 'found' messages when a resource if found by a loader.
The key is :
resource.manager.logwhenfound
and the default is true (current behavior). Note that this logging only happens
the first time a resource is found - when cached, subsequent access will not log.
Revision Changes Path
1.26 +7 -1
jakarta-velocity/src/java/org/apache/velocity/runtime/RuntimeConstants.java
Index: RuntimeConstants.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/RuntimeConstants.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- RuntimeConstants.java 2001/04/22 18:17:42 1.25
+++ RuntimeConstants.java 2001/05/20 21:40:40 1.26
@@ -62,7 +62,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: RuntimeConstants.java,v 1.25 2001/04/22 18:17:42 geirm Exp $
+ * @version $Id: RuntimeConstants.java,v 1.26 2001/05/20 21:40:40 geirm Exp $
*/
public interface RuntimeConstants
{
@@ -253,6 +253,12 @@
* R E S O U R C E L O A D E R C O N F I G U R A T I O N
* ----------------------------------------------------------------------
*/
+
+ /**
+ * controls if the finding of a resource is logged
+ */
+ public static final String RESOURCE_MANAGER_LOGWHENFOUND =
+ "resource.manager.logwhenfound";
/**
* Key used to retrieve the names of the resource loaders
1.29 +19 -3
jakarta-velocity/src/java/org/apache/velocity/runtime/resource/ResourceManager.java
Index: ResourceManager.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/resource/ResourceManager.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- ResourceManager.java 2001/05/15 13:26:26 1.28
+++ ResourceManager.java 2001/05/20 21:40:40 1.29
@@ -81,7 +81,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Paulo Gaspar</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ResourceManager.java,v 1.28 2001/05/15 13:26:26 geirm Exp $
+ * @version $Id: ResourceManager.java,v 1.29 2001/05/20 21:40:40 geirm Exp $
*/
public class ResourceManager
{
@@ -143,6 +143,12 @@
private static boolean resourceLoaderInitializersActive = false;
/**
+ * switch to turn off log notice when a resource is found for
+ * the first time.
+ */
+ private static boolean logWhenFound = true;
+
+ /**
* Initialize the ResourceManager. It is assumed
* that assembleSourceInitializers() has been
* called before this is run.
@@ -173,6 +179,12 @@
resourceLoaders.add(resourceLoader);
}
+
+ /*
+ * now see if this is overridden by configuration
+ */
+
+ logWhenFound = Runtime.getBoolean( Runtime.RESOURCE_MANAGER_LOGWHENFOUND,
true );
}
/**
@@ -383,8 +395,12 @@
* it out due to to the new
* multi-path support - will revisit and fix
*/
- Runtime.info("ResourceManager : found " + resourceName
+
- " with loader " +
resourceLoader.getClassName());
+
+ if ( logWhenFound )
+ {
+ Runtime.info("ResourceManager : found " +
resourceName +
+ " with loader " +
resourceLoader.getClassName());
+ }
howOldItWas = resourceLoader.getLastModified( resource
);
break;