[EMAIL PROTECTED] writes: >- rsvc.warn("JarResourceLoader : you are using a deprecated >configuration" >+ log.warn("JarResourceLoader : you are using a deprecated >configuration"
Ah, I see that Nathan's patch deprecated rsvc.debug() etc. Good move! There is the issue that we have the RuntimeLogger interface where the methods are not deprecated but we also have its implementation where they are. I think we should also deprecate the whole RuntimeLogger interface. Best regards Henning > + " property for the JarResourceLoader -> > '<name>.resource.loader.resource.path'." > + " Please change to the conventional > '<name>.resource.loader.path'."); > } > } > >- rsvc.info("JarResourceLoader # of paths : " + paths.size() ); >+ log.info("JarResourceLoader # of paths : " + paths.size() ); > > for ( int i=0; i<paths.size(); i++ ) > { > loadJar( (String)paths.get(i) ); > } > >- rsvc.info("JarResourceLoader : initialization complete."); >+ log.info("JarResourceLoader : initialization complete."); > } > > private void loadJar( String path ) > { >- rsvc.info("JarResourceLoader : trying to load: " + path); >+ log.info("JarResourceLoader : trying to load: " + path); > > // Check path information > if ( path == null ) > { >- rsvc.error("JarResourceLoader : can not load JAR - JAR path is >null"); >+ log.error("JarResourceLoader : can not load JAR - JAR path is >null"); > } > if ( !path.startsWith("jar:") ) > { >- rsvc.error("JarResourceLoader : JAR path must start with jar: -> >" + >+ log.error("JarResourceLoader : JAR path must start with jar: -> " >+ > "see java.net.JarURLConnection for information"); > } > if ( !path.endsWith("!/") ) >@@ -193,7 +193,7 @@ > " contains .. and may be trying to access " + > "content outside of template root. Rejected."; > >- rsvc.error( "JarResourceLoader : " + msg ); >+ log.error( "JarResourceLoader : " + msg ); > > throw new ResourceNotFoundException ( msg ); > } >Modified: >jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java >URL: >http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java?rev=292918&r1=292917&r2=292918&view=diff >============================================================================== >--- >jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java > (original) >+++ >jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java > Fri Sep 30 21:36:58 2005 >@@ -19,7 +19,7 @@ > import java.io.InputStream; > > import org.apache.velocity.runtime.RuntimeServices; >- >+import org.apache.velocity.runtime.log.Log; > import org.apache.velocity.runtime.resource.Resource; > import org.apache.velocity.runtime.resource.ResourceCacheImpl; > >@@ -56,6 +56,7 @@ > protected String className = null; > > protected RuntimeServices rsvc = null; >+ protected Log log = null; > > /** > * This initialization is used by all resource >@@ -65,6 +66,7 @@ > public void commonInit( RuntimeServices rs, ExtendedProperties > configuration) > { > this.rsvc = rs; >+ this.log = rsvc.getLog(); > > /* > * these two properties are not required for all loaders. >@@ -81,8 +83,7 @@ > catch (Exception e) > { > isCachingOn = false; >- rs.error(e.getMessage() + ": Using default of '" + isCachingOn >- + '\''); >+ log.error("Exception using default of '" + isCachingOn + '\'', e); > } > try > { >@@ -91,8 +92,8 @@ > catch (Exception e) > { > modificationCheckInterval = 0; >- rs.error(e.getMessage() + ": Using default of '" + >- modificationCheckInterval + '\''); >+ log.error("Exception using default of '" + >+ modificationCheckInterval + '\'', e); > } > > /* >@@ -105,8 +106,7 @@ > } > catch (Exception e) > { >- rs.error(e.getMessage() + ": Using default of '" + className >- + '\''); >+ log.error("Exception using default of '" + className + '\'', e); > } > } > >Modified: >jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java >URL: >http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java?rev=292918&r1=292917&r2=292918&view=diff >============================================================================== >--- >jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java > (original) >+++ >jakarta/velocity/core/trunk/src/java/org/apache/velocity/runtime/resource/loader/ResourceLoaderFactory.java > Fri Sep 30 21:36:58 2005 >@@ -41,17 +41,17 @@ > { > loader = (ResourceLoader) ClassUtils.getNewInstance( > loaderClassName ); > >- rs.info("Resource Loader Instantiated: " + >- loader.getClass().getName()); >+ rs.getLog().info("Resource Loader Instantiated: " + >+ loader.getClass().getName()); > > return loader; > } > catch( Exception e) > { >- rs.error("Problem instantiating the template loader.\n" + >+ rs.getLog().error("Problem instantiating the template loader.\n" + > "Look at your properties file and make sure the\n" + > "name of the template loader is correct. Here is > the\n" + >- "error: " + StringUtils.stackTrace(e)); >+ "error:", e); > > throw new Exception("Problem initializing template loader: " + > loaderClassName + > "\nError is: " + StringUtils.stackTrace(e)); >Modified: >jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java >URL: >http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java?rev=292918&r1=292917&r2=292918&view=diff >============================================================================== >--- >jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java > (original) >+++ >jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/Introspector.java > Fri Sep 30 21:36:58 2005 >@@ -17,7 +17,8 @@ > */ > > import java.lang.reflect.Method; >- >+import org.apache.velocity.runtime.log.Log; >+import org.apache.velocity.runtime.log.RuntimeLoggerLog; > import org.apache.velocity.runtime.RuntimeLogger; > > /** >@@ -59,16 +60,21 @@ > "Introspector : detected classloader change. Dumping cache."; > > /** >- * our engine runtime services >+ * The Log we use > */ >- private RuntimeLogger rlog = null; >+ private Log log = null; >+ >+ public Introspector(Log log) >+ { >+ this.log = log; >+ } > > /** >- * Recieves our RuntimeServices object >+ * @deprecated RuntimeLogger is deprecated. Use Introspector(Log log). > */ > public Introspector(RuntimeLogger logger) > { >- this.rlog = logger; >+ this(new RuntimeLoggerLog(logger)); > } > > /** >@@ -115,7 +121,7 @@ > > msg = msg + ") for class " + c; > >- rlog.error( msg ); >+ log.error( msg ); > } > > return null; >@@ -128,6 +134,6 @@ > protected void clearCache() > { > super.clearCache(); >- rlog.info( CACHEDUMP_MSG ); >+ log.info( CACHEDUMP_MSG ); > } > } >Modified: >jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java >URL: >http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java?rev=292918&r1=292917&r2=292918&view=diff >============================================================================== >--- >jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java > (original) >+++ >jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectImpl.java > Fri Sep 30 21:36:58 2005 >@@ -22,7 +22,8 @@ > import java.util.Enumeration; > import java.util.Iterator; > import java.util.Map; >- >+import org.apache.velocity.runtime.log.Log; >+import org.apache.velocity.runtime.log.RuntimeLoggerLog; > import org.apache.velocity.runtime.RuntimeLogger; > import org.apache.velocity.runtime.parser.node.AbstractExecutor; > import org.apache.velocity.runtime.parser.node.BooleanPropertyExecutor; >@@ -43,7 +44,7 @@ > /** > * Our runtime logger. > */ >- private RuntimeLogger rlog; >+ private Log log; > > /** > * the default Velocity introspector >@@ -65,10 +66,20 @@ > * else besides init() as to get the logger. Makes the pull > * model appealing... > */ >+ public void setLog(Log log) >+ { >+ this.log = log; >+ introspector = new Introspector(log); >+ } >+ >+ /** >+ * @deprecated Use setLog(Log log) instead. >+ */ > public void setRuntimeLogger(RuntimeLogger runtimeLogger) > { >- rlog = runtimeLogger; >- introspector = new Introspector(rlog); >+ // in the off chance anyone still uses this method >+ // directly, use this hack to keep it working >+ setLog(new RuntimeLoggerLog(runtimeLogger)); > } > > /** >@@ -95,7 +106,7 @@ > } > else if (obj instanceof Iterator) > { >- rlog.debug("The iterative object in the #foreach() loop at " + >+ log.debug("The iterative object in the #foreach() loop at " + > i + " is of type java.util.Iterator. Because " + > "it is not resettable, if used in more than once it " + > "may lead to unexpected results."); >@@ -104,7 +115,7 @@ > } > else if (obj instanceof Enumeration) > { >- rlog.debug("The iterative object in the #foreach() loop at " + >+ log.debug("The iterative object in the #foreach() loop at " + > i + " is of type java.util.Enumeration. Because " + > "it is not resettable, if used in more than once it " + > "may lead to unexpected results."); >@@ -113,7 +124,7 @@ > } > > /* we have no clue what this is */ >- rlog.warn("Could not determine type of iterator in " + >+ log.warn("Could not determine type of iterator in " + > "#foreach loop at " + i); > > return null; >@@ -148,7 +159,7 @@ > * (also getfoo() ) > */ > >- executor = new PropertyExecutor(rlog,introspector, claz, identifier); >+ executor = new PropertyExecutor(log,introspector, claz, identifier); > > /* > * if that didn't work, look for get("foo") >@@ -156,7 +167,7 @@ > > if (!executor.isAlive()) > { >- executor = new GetExecutor(rlog, introspector, claz, identifier); >+ executor = new GetExecutor(log, introspector, claz, identifier); > } > > /* >@@ -165,7 +176,7 @@ > > if (!executor.isAlive()) > { >- executor = new BooleanPropertyExecutor(rlog, introspector, claz, >+ executor = new BooleanPropertyExecutor(log, introspector, claz, > identifier); > } > >Modified: >jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectLoggable.java >URL: >http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectLoggable.java?rev=292918&r1=292917&r2=292918&view=diff >============================================================================== >--- >jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectLoggable.java > (original) >+++ >jakarta/velocity/core/trunk/src/java/org/apache/velocity/util/introspection/UberspectLoggable.java > Fri Sep 30 21:36:58 2005 >@@ -1,7 +1,7 @@ > package org.apache.velocity.util.introspection; > > /* >- * Copyright 2002-2004 The Apache Software Foundation. >+ * Copyright 2002-2005 The Apache Software Foundation. > * > * Licensed under the Apache License, Version 2.0 (the "License") > * you may not use this file except in compliance with the License. >@@ -17,6 +17,7 @@ > */ > > import org.apache.velocity.runtime.RuntimeLogger; >+import org.apache.velocity.runtime.log.Log; > > /** > * Marker interface to let an uberspector indicate it can and wants to >@@ -24,15 +25,22 @@ > * > * Thanks to Paulo for the suggestion > * >+ * @author <a href="mailto:[EMAIL PROTECTED]">Nathan Bubna</a> > * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a> > * @version $Id$ > * > */ > public interface UberspectLoggable > { >+ >+ /** >+ * Sets the logger. This will be called before any calls to the >+ * uberspector >+ */ >+ public void setLog(Log log); >+ > /** >- * Sets the logger. This will be called before any calls to the >- * uberspector >+ * @deprecated Use setLog(Log log) instead. > */ > public void setRuntimeLogger(RuntimeLogger logger); > } >Modified: >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ClassloaderChangeTestCase.java >URL: >http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ClassloaderChangeTestCase.java?rev=292918&r1=292917&r2=292918&view=diff >============================================================================== >--- >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ClassloaderChangeTestCase.java > (original) >+++ >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ClassloaderChangeTestCase.java > Fri Sep 30 21:36:58 2005 >@@ -27,7 +27,7 @@ > import org.apache.velocity.VelocityContext; > import org.apache.velocity.app.VelocityEngine; > import org.apache.velocity.runtime.RuntimeServices; >-import org.apache.velocity.runtime.log.LogSystem; >+import org.apache.velocity.runtime.log.LogChute; > import org.apache.velocity.util.introspection.Introspector; > > /** >@@ -36,7 +36,7 @@ > * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a> > * @version $Id$ > */ >-public class ClassloaderChangeTestCase extends TestCase implements LogSystem >+public class ClassloaderChangeTestCase extends TestCase implements LogChute > { > private VelocityEngine ve = null; > private boolean sawCacheDump = false; >@@ -55,10 +55,6 @@ > public void setUp() > throws Exception > { >- /* >- * use an alternative logger. Set it up here and pass it in. >- */ >- > ve = new VelocityEngine(); > ve.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM, this ); > ve.init(); >@@ -142,12 +138,27 @@ > * method to catch Velocity log messages. When we > * see the introspector dump message, then set the flag > */ >- public void logVelocityMessage(int level, String message) >+ public void log(int level, String message) > { > if (message.equals( Introspector.CACHEDUMP_MSG) ) > { > sawCacheDump = true; > } >+ } >+ >+ /** >+ * method to catch Velocity log messages. When we >+ * see the introspector dump message, then set the flag >+ */ >+ public void log(int level, String message, Throwable t) >+ { >+ // ignore the Throwable for this test >+ log(level, message); >+ } >+ >+ public boolean isLevelEnabled(int level) >+ { >+ return true; > } > } > >Modified: >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java >URL: >http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java?rev=292918&r1=292917&r2=292918&view=diff >============================================================================== >--- >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java > (original) >+++ >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/EventHandlingTestCase.java > Fri Sep 30 21:36:58 2005 >@@ -35,7 +35,7 @@ > import org.apache.velocity.exception.MethodInvocationException; > import org.apache.velocity.runtime.RuntimeConstants; > import org.apache.velocity.runtime.RuntimeServices; >-import org.apache.velocity.runtime.log.LogSystem; >+import org.apache.velocity.runtime.log.LogChute; > > /** > * Tests event handling for all event handlers except IncludeEventHandler. > This is tested >@@ -46,7 +46,7 @@ > */ > public class EventHandlingTestCase > extends TestCase >- implements LogSystem >+ implements LogChute > { > private static String NO_REFERENCE_VALUE = "<no reference value>"; > private static String REFERENCE_VALUE = "<reference value>"; >@@ -284,7 +284,7 @@ > } > > /** >- * Required by LogSystem >+ * Required by LogChute > */ > public void init( RuntimeServices rs ) > { >@@ -292,11 +292,21 @@ > } > > /** >- * handler for LogSystem interface >+ * handler for LogChute interface > */ >- public void logVelocityMessage(int level, String message) >+ public void log(int level, String message) > { > setLogString(message); >+ } >+ >+ public void log(int level, String message, Throwable t) >+ { >+ setLogString(message); >+ } >+ >+ public boolean isLevelEnabled(int level) >+ { >+ return true; > } > > public static void clearLogString() >Modified: >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ExternalLoggerTestCase.java >URL: >http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ExternalLoggerTestCase.java?rev=292918&r1=292917&r2=292918&view=diff >============================================================================== >--- >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ExternalLoggerTestCase.java > (original) >+++ >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/ExternalLoggerTestCase.java > Fri Sep 30 21:36:58 2005 >@@ -22,7 +22,7 @@ > > import org.apache.velocity.app.VelocityEngine; > import org.apache.velocity.runtime.RuntimeServices; >-import org.apache.velocity.runtime.log.LogSystem; >+import org.apache.velocity.runtime.log.LogChute; > > /** > * Tests if we can hand Velocity an arbitrary class for logging. >@@ -30,7 +30,7 @@ > * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a> > * @version $Id$ > */ >-public class ExternalLoggerTestCase extends TestCase implements LogSystem >+public class ExternalLoggerTestCase extends TestCase implements LogChute > { > > private String logString = null; >@@ -87,7 +87,7 @@ > } > } > >- public void logVelocityMessage(int level, String message) >+ public void log(int level, String message) > { > String out = ""; > >@@ -96,16 +96,19 @@ > */ > switch( level ) > { >- case LogSystem.DEBUG_ID : >+ case LogChute.DEBUG_ID : > out = VelocityEngine.DEBUG_PREFIX; > break; >- case LogSystem.INFO_ID : >+ case LogChute.INFO_ID : > out = VelocityEngine.INFO_PREFIX; > break; >- case LogSystem.WARN_ID : >+ case LogChute.TRACE_ID : >+ out = VelocityEngine.TRACE_PREFIX; >+ break; >+ case LogChute.WARN_ID : > out = VelocityEngine.WARN_PREFIX; > break; >- case LogSystem.ERROR_ID : >+ case LogChute.ERROR_ID : > out = VelocityEngine.ERROR_PREFIX; > break; > default : >@@ -114,5 +117,16 @@ > } > > logString = out + message; >+ } >+ >+ public void log(int level, String message, Throwable t) >+ { >+ // ignore the Throwable, we're not testing this method here >+ log(level, message); >+ } >+ >+ public boolean isLevelEnabled(int level) >+ { >+ return true; > } > } >Modified: >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java >URL: >http://svn.apache.org/viewcvs/jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java?rev=292918&r1=292917&r2=292918&view=diff >============================================================================== >--- >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java > (original) >+++ >jakarta/velocity/core/trunk/src/test/org/apache/velocity/test/FilteredEventHandlingTestCase.java > Fri Sep 30 21:36:58 2005 >@@ -32,7 +32,7 @@ > import org.apache.velocity.exception.MethodInvocationException; > import org.apache.velocity.runtime.RuntimeConstants; > import org.apache.velocity.runtime.RuntimeServices; >-import org.apache.velocity.runtime.log.LogSystem; >+import org.apache.velocity.runtime.log.LogChute; > > /** > * Tests event handling for all event handlers when multiple event handlers > are >@@ -41,7 +41,7 @@ > * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a> > * @version $Id$ > */ >-public class FilteredEventHandlingTestCase extends BaseTestCase implements >LogSystem >+public class FilteredEventHandlingTestCase extends BaseTestCase implements >LogChute > { > > /** >@@ -88,7 +88,7 @@ > > > /** >- * Required by LogSystem >+ * Required by LogChute > */ > public void init( RuntimeServices rs ) > { >@@ -247,11 +247,21 @@ > > > /** >- * handler for LogSystem interface >+ * handler for LogChute interface > */ >- public void logVelocityMessage(int level, String message) >+ public void log(int level, String message) > { > logString = message; >+ } >+ >+ public void log(int level, String message, Throwable t) >+ { >+ logString = message; >+ } >+ >+ public boolean isLevelEnabled(int level) >+ { >+ return true; > } > > } >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH [EMAIL PROTECTED] +49 9131 50 654 0 http://www.intermeta.de/ RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire Linux, Java, perl, Solaris -- Consulting, Training, Development 4 - 8 - 15 - 16 - 23 - 42 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]