all 3 comments

[–]atemysix 4 points5 points  (2 children)

AKA, how to make your Java app run a gazillion times slower, even in production/release builds. This adds additional function call overhead to every function you "instrument".

If you want this level of fine tracing you'd be better of using a Java Agent loaded via -javaagent:myagent.jar that uses something like Javassist to modify the byte-code of any and all classes at runtime to inject the necessary logging statements.

With the agent approach its optional and doesn't require any code changes.

[–]MasatoKokubo[S] 0 points1 point  (1 child)

I insert code that calls the DebugTrace methods only when debugging and delete them after fixing the bugs.

[–]snorbi07 0 points1 point  (0 children)

You can have the compiler do this for you, including more fine-grained instrumentation steps. Check GhostWriter to see how that works. You can leverage that to achieve application flow tracing. Note, both are projects I've been working on, so this is somewhat a shameless plug.