Wednesday, August 13, 2008

Trace this application

OK, so here is the situation you join a new software product development team which still in its Beta and the original contributors are just too busy with their assignment or consider the code documentation too detrimental to their 'geek' quotient and then you are made to check out the code and do a local build so that when you meet the team next time and you are ready with your doubts and question to improve your understanding... err! excuse me?!! heard any time 'more study-more confusion, no study-no confusion' ... but then what's the big deal you may always cover your eyes and think that problem is no their or in case you decide to give a fight you have traditionally handwritten the trace logs all over the application... given the fact that even the most modest enterprise class software will good enough class count to keep you busy for couple of days this is too big a task and then what if you don't have the liberty any ways because those trace logs wont be present in a production system anyways... KAZAAM! here comes the latest offering (at least to my knowledge) from lady Java, the Instrumentation API which provides services using java agents can instrument your aplication while running on the JVM. Find details here
http://today.java.net/pub/a/today/2008/04/24/add-logging-at-class-load-time-with-instrumentation.html

But, then again this is jus another Hello, World 'application' which only further makes your life miserable because now u know that a plausible solution to your problem exists but then lack the robustness to face real time producion challenge. You find the following open source component handy
http://jiprof.sourceforge.net/

But, then web applications are real pain in their own ways because every thing is controlled by the container 'transparently'... for those of you who are in real rush do try to find about options using which you can also instrument your code executing on infrastructure software for e.g.

When using with stock Tomcat, set the java agent by using the env. variable JAVA_OPTS. For example, on Windows™ use the following:

SET JAVA_OPTS=-javaagent:[DIR]\.jar -.properties=[DIR2]\.properties

Who says lethargy doesn't pushes you to innovate?!!

No comments: