• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Action Class - Logging timing

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a quick and easy way to log timing for the execute method of the action class? I want to keep track of how long the execute method took to complete. I extended the process() method of the RequestProcessor and kept track of how long the processActionPerform() method took to complete. However, I am not comfortable with having to modify native struts code in the process() method. Is there another less invasive way to implement log timing?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One possible way to do this would be to write a base Action class that extends Action, and then have all your Action classes extend your base Action class. You could then implement your logging in the base Action class.
 
Leonard Murro
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the base action class - Would I extend on any particular method or would I need to create a new method? How could I get access to the before and after time of the execute method?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are many ways to do this, but one way would be to definie an abstract method named something other than execute (e.g. myExecute) that your subclasses must implement. Then call this method from your base Action class's execute method. You could then get the begin time before calling myExecute and the end time after myExecute returns. This would also give you an opportunity to do whatever other tasks you want every Action to perform, such as checking security roles, checking for valid session, etc.
[ April 10, 2006: Message edited by: Merrill Higginson ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic