Sunday, July 30, 2017

Java Flight Recorder JFR: enable recording of exceptions

how to specify custom settings for JFR

http://isuru-perera.blogspot.it/2016/03/specifying-custom-event-settings-file.html

The default settings are in C:\Program Files\Java\jre1.8.0_121\lib\jfr\default.jfc (in Windows... otherwise in JAVA_HOME/jre/lib/jfr/default.jfc in Linux.

so you can enable also the "Exceptions" event, just copy the default.jfc to /tmp/default.jfc, hack it

<event path="java/exception_throw">
      <setting name="enabled" control="http://www.oracle.com/hotspot/jvm/enable-exceptions">false</setting>
      <setting name="stackTrace">true</setting>
    </event>


set it to true

and start the jfr with

jcmd JFR.start settings=/tmp/default.jfc

and you will smile and be happy



No comments: