I need to log all run-time access to any variable or object My current direction is to markup the classfile with modified 开发者_高级运维bytecode Performance is not currently an issue
BCEL looks nice to add some trace instructions to each relevant opcode in the bytecode
However, i would also like to add some semantic information from the source file e.g. this variable is a for-loop counter This would require some AST / parsing tree manipulation.
So are ASM / JavaAssist better choices ???
Logging the variable-usage is the key requirement - so bytecode looks like the right level to handle this. But eventually i will have to access the source parse tree to get more semantic information
Any thoughts ?
p.s. this will be a large prolonged project
Look into JavaSnoop (https://www.aspectsecurity.com/research/appsec_tools/javasnoop/). It will help you monitor function calls.
精彩评论