Re: Question for using ASM to log the method invocation trace.

Paul Keeble <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Say you have a class:
class Tracer {
public static void trace(String )

public static void close()
}

Then you can happily insert the calls to Tracer.trace for the instrumenting. You can also right at the beginning of the program (before you instrument anything and when you set-up the FileWriter to begin with) set-up a shutdown hook using something like:

Runtime.getRuntime().addShutdownHook(new Thread() {
  public void run() {
    Tracer.close();
}});

Its not a concern of the tracing to get the file stream closed, it is for the shutdown of the program.

PK



________________________________
From: Zhongxian Gu <[email protected]>
To: [email protected]
Sent: Wed, 30 June, 2010 5:10:33
Subject: [asm] Question for using ASM to log the method invocation trace.

Hi all,

I wish to use ASM to instrument the code and during the run, record the method invocation trace. I use AdviceAdapter to do that. To enhance the performance,
I use BufferedWriter to print info to the log file. The problem is that I don't know how to instrument the code to close the BufferedWriter. I must call it until all the 
methods called which is only known at run-time. Without calling close method will cause information missing in the buffer. 

I wonder if some of you have also experienced this condition and could you give me some hints. Thanks

Best

Zhongxian

-- 
Zhongxian Gu
http://wwwcsif.cs.ucdavis.edu/~gu/
Ph.D. Student in Computer Science, UC Davis
2249 Kemper Hall
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.