Garbage collection notification?

前端 未结 11 593
北海茫月
北海茫月 2020-12-30 19:31

I\'d like to register a callback with the JVM so I know when garbage collection is happening. Is there any way to do this?

EDIT: I want to do this so I can log out

11条回答
  •  执念已碎
    2020-12-30 20:23

    If you're looking at this as a diagnostic tool, I recommend redirecting your application log to StdOut and then redirecting both StdOut and StdErr into a file. This will give you the detail of JVM logging, without forcing you to change your application code.

提交回复
热议问题