Friday, November 11, 2016

How To Customize WebLogic Server Flight Recorder Events

Applies to:

Oracle WebLogic Server - Version 10.3.6 and later
Information in this document applies to any platform.

Goal

How to customize WebLogic Server flight recording events?

Solution

There are two ways to archive this requirement.

1. Using JRMC

Step1. Start Flight Recording
jrmc1
Step2: Click 'Advanced'
jrmc2
Step3: Uncheck 'Show only template settings'. After that, WebLogic Server events will show up
jrmc3
Steps4: Select WebLogic Server events that you want to trace:
jrmc4
Step5: Start Flight Recording and test again. Only selected events are recorded.
jrmc5


2. Using JRCMD:

You could use following JVM option to specify the JFS template to use:
-XX:FlightRecorderOptions=settings=<file_location.jfs>
For example:
jrcmd <pid> start_flightrecording duration=30s settings=D:/wls_ejb.jfs compress=true settings=D:/wls_ejb.jfs
If JFS file is already copied to $JRockit_HOME\jre\lib\jfr, then could use the name directly. Like:
jrcmd <pid> start_flightrecording duration=30s settings=wls_ejb
To get the JFR recording, use following command
jrcmd <pid> dump_flightrecording id=<record id> copy_to_file=<jfr location>
 Or just stop it
 jrcmd <pid> stop_flightrecording recording=<record id>
There is not Utility tool to convert JRT to JFS. You have to write you own cutomization JFS template. For example, following JFS configuration will capture EJB_Business_Method_Invoke events only:
{
 "http://www.oracle.com/wls/flightrecorder/low/" :
   {
     "*" :
     {
        "enable" : false,
        "stacktrace" : false,
        "threshold" : 10ms,
        "period" : 1000ms
      },
     "wls/EJB/EJB_Business_Method_Invoke" :
     {
         "enable" : true,
         "period" : 0
      }
   }
}
You could try following steps to get the path definitions:

1. Start a flight recording task.
2. Issue following command to check the flight recording status
jrcmd <pid> check_flightrecording verbose
3. You will find some lines in output like:
...
http://www.oracle.com/wls/flightrecorder/medium/:
  wls/EJB/EJB_Home_Create : disabled threshold=-1
  wls/EJB/EJB_Home_Remove : disabled threshold=-1
  wls/EJB/EJB_Pool_Manager_Create : disabled threshold=-1
  wls/EJB/EJB_Pool_Manager_Post_Invoke : disabled
  wls/EJB/EJB_Pool_Manager_Pre_Invoke : disabled
  wls/JDBC/JDBC_Connection_Close : disabled threshold=-1
  wls/JDBC/JDBC_Connection_Commit : disabled threshold=-1
  wls/JDBC/JDBC_Connection_Create_Statement : disabled threshold=-1
...
4. Then you could refer to the output and modify your own JFS template.

No comments:

Post a Comment