You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Victor Wiewiorowski <vw...@valuecommerce.ne.jp> on 2003/04/03 03:50:13 UTC

[PATCH] Logging of stack traces

In debugging my Velocity web-app I've been frustrated in that there
seemed to be no way to get velocity to log the stack trace when
an error happens. Setting of VelocityEngine.RUNTIME_LOG_ERROR_STACKTRACE
or even VelocityEngine.RUNTIME_LOG_WARN_STACKTRACE seemed
to not do anything. After a few hours of poking around, I discovered
that in fact the code was not there to log stack traces.

There were two problems:
1) RuntimeInstance.showStackTrace() first checks
configuration.isInitialized(), which
always seems to return false. :(
2) Parse.render did not pass the exception to the logging system, it just
constructed a message with catch(Exception e) { log("...message.."
+e.getMessage());}

I propose the following fixes :
1) In RuntimeInstance.showStackTrace() do not check
configuration.isInitialized().
2) To RuntimeLogger interface add a error(String message, Throwable t)
method.

I have implemented the above, please consider the attached patches, I think
they will
greatly help anyone debugging their Velocity applications.


Also note that as far as I can tell the
VelocityEngine.RUNTIME_LOG_ERROR_STACKTRACE
setting is not referenced anywhere. I would suggest replacing
RUNTIME_LOG_ERROR_STACKTRACE
and RUNTIME_LOG_WARN_STACKTRACE, with RUNTIME_LOG_STACKTRACE, since that
seems to be the actual behaviour. I have not implemented this.

Regards,


Victor Wiewiorowski
ValueCommerce Co., Ltd.