turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rex Madden" <rexmad...@yahoo.com>
Subject RE: Velocity Stack Trace
Date Mon, 03 Feb 2003 17:48:29 GMT
Thanks Walt.  I tried using the nightly release of the collections, but
no luck.  Maybe I needed to hit the CVS directly?  Oh well, I needed to
hack the Velocity stuff anyway, so I went with plan B.

I finally got it to work, but then it still wouldn't log stacktraces
consistently.  The problem is that sometimes when an error is caught
from a method invocation, it seems to just try to log a string instead
of the exception...not what I wanted.  So I made sure it was logging a
MethodInvocationException, instead.  

Of course, the MethodInvocationException isn't a nestable exception.  It
just stores the original exception, but never prints it out.  I went for
the quick hack in RuntimeInstance.log to keep looping through exception
and adding them on to the output, like this:

           Throwable e = (Throwable) message;
           while (e != null){
              out += StringUtils.stackTrace(e);

              if (e instanceof MethodInvocationException) {
                 e = ((MethodInvocationException)
e).getWrappedThrowable();
              } else e = null;
           }

Probably should have just made it a NestableException, or at least
override MethodInvocationException's print stack trace, but this works
for now, so I'm going with it.

Maybe this is all unnecessary, but it's working for me so far.

Rex




-----Original Message-----
From: Walt Armour [mailto:WaltA@concur.com] 
Sent: Sunday, February 02, 2003 10:14 PM
To: 'Turbine Users List'
Subject: RE: Velocity Stack Trace

This is a bug between velocity and commons-collections.

Velocity checks to see if the properties have been initialized (see
RuntimeInstance.showStackTrace()) before it will do a stack dump.
Unfortunately the properties never get flagged as initialized because of
a
bug in commons-collections (I recently submitted a patch for this which
has
been applied, check cvs).

That should be enough but I still get inconsistent results in getting my
stack traces.  One thing to note (I consider this a bug in velocity) is
that
the only property used to check for stack traces is the warn.stacktrace
property.  The info. and error. properties are not used (anywhere best I
can
tell).

For the moment I'm running a hacked version that doesn't even call
showStackTrace() anymore.  That seems to be effective.  The flakiness I
mention above might simply be because of the "fluidity" of my code :)
and
the fix to commons-collections may be sufficient.


> -----Original Message-----
> From: Rex Madden [mailto:rexmadden@yahoo.com] 
> Sent: Sunday, February 02, 2003 6:47 PM
> To: turbine-user@jakarta.apache.org
> Subject: Velocity Stack Trace
> 
> 
> Hi,
>  
> I'm trying to turn on stack traces for Velocity, but can't seem to get
> it to work.  I put the following in my 
> TurbineResources.properties, but
> nothing happened:
>  
> services.VelocityService.runtime.log.error.stacktrace = true
> services.VelocityService.runtime.log.warn.stacktrace = true
>  
>  
>  
> I don't have any velocity.properties files in my classpath or 
> anywhere.
>  
> I also changed the default velocity.properties file in the 
> velocity.jar
> for good measure.
>  
> I'm using velocity 1.3.1rc2.  If anyone has any suggestions, I would
> appreciate it.
>  
> Thanks,
> Rex
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Mime
View raw message