You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Oliver Kohll <ol...@gtwebmarque.com> on 2005/11/20 01:39:32 UTC

Logging request execution time

Hi,

I'm using VelocityServlet to handle requests in a web app and I want  
to time each request.

At the moment I've just got a very simple method (as in a way of  
doing things, not a Java method) that records the time at the start  
of handleRequest() and at the end before the 'return template' and  
logs the difference. However, of course this time doesn't include  
that spend parsing the Velocity template because it stops before the  
return statement of handleRequest().

Does anyone know of a way of either logging the velocity rendering  
time or logging the global time for the whole request?

Things I've thought of are:

a) using a profiler like JProbe or Hyperic  - overkill, too expensive  
and I want to run it on the app in production not just in development

b) using a servlet filter to wrap the entire request and time it -  
looks like it may degrade performance(?)

c) overriding mergeTemplate() in VelocityServlet as well as  
handleRequest() - the Javadoc says 'Only override this if you really,  
really really need to. (And don't call us with questions if it  
breaks :)' - I can't see a problem in wrapping a super() call in some  
timing code though.

d) configuring velocity itself to log rendering time - don't know if  
this is possible and really I want the it to add it to the general  
request processing time anyway.

I see Jamon uses method b), I may try their software first - http:// 
www.jamonapi.com/ or try c) myself.

Does anyone have any advice or other ideas?

Best regards,

Oliver Kohll

GT webMarque
oliver@gtwebmarque.com / 0845 456 1810 / 07814 828608
Furze Bank, 34 Hanover Street, SWANSEA UK, SA1 6BA


NOTE
No contracts may be concluded on behalf of GT webMarque by means of e- 
mail
communications. The contents of this e-mail are confidential to the
intended recipient at the e-mail address to which it has been addressed;
it may not be disclosed to or used by anyone other than this addressee,
nor may it be copied in any way. If received in error please return to
sender via e-mail.

DISCLAIMER
Please note that neither GT webMarque Ltd nor the sender accept any
responsibility for viruses transmitted via e-mail. It is your
responsibility to scan attachments (if any).



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