A DESCRIPTION OF THE PROBLEM : According to official documentation of FlightRecorderMXBeanImpl, there should be a valid recording option availabe - destination, which specifies the path where recording data is written when the recording stops. However, such an option is not supported in the source code and using this options ends with following exception: IllegalArgumentException("Unknown recording option: destination. Valid options are maxSize, maxAge, name, disk, dumpOnExit, duration) STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. create flightRecorderMXBean instance 2. long recordingId = flightRecorderMXBean.newRecording(); 3. flightRecorderMXBean.setRecordingOptions(recordingId, getPredefinedRecordingOptions()); 4. flightRecorderMXBean.setPredefinedConfiguration(recordingId, "profile"); 5. flightRecorderMXBean.startRecording(recordingId); This is what getPredefinedRecordingOptions() returns: private Map<String, String> getPredefinedRecordingOptions() { return new HashMap<>() {{ put("name", "recording"); put("maxAge", "10 m"); put("maxSize", Long.toString(1024 * 1024 * 1024)); put("dumpOnExit", "true"); put("disk", "true"); put("duration", "3 m"); put("destination", "/recordings/recording.jfr"); }}; } EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Recording successfully starts ACTUAL - Following exception is thrown: IllegalArgumentException("Unknown recording option: destination. Valid options are maxSize, maxAge, name, disk, dumpOnExit, duration) CUSTOMER SUBMITTED WORKAROUND : Use copyTo method in FlightRecorderMXBeanImpl to achieve storing into desired directory and file. FREQUENCY : always
|