Включаю Java Flight Recorder:
@SpringBootApplication
public class AppInitializer {
public static void main(String[] args)
{
var context = new SpringApplicationBuilder(AppInitializer.class)
.child(WebConfig.class)
.initializers(ConditionEvaluationReportLoggingListener.forLogLevel(LogLevel.DEBUG))
.web(WebApplicationType.SERVLET)
.applicationStartup(new FlightRecorderApplicationStartup())
.run(args);
}
}
Архивирую в jar и запускаю приложение разными командами:
java -XX:StartFlightRecording:filename=recording.jfr,duration=10s,settings=profile,dumponexit=true -jar DatingSpringBoot.jar --myparam=val
java -XX:StartFlightRecording:filename=recording.jfr,duration=10s,settings=profile -jar DatingSpringBoot.jar --myparam=val
В обоих случаях пишет, что запись началась:
[1.327s][info][jfr,startup] Started recording 1. The result will be written to:
[1.327s][info][jfr,startup]
[1.327s][info][jfr,startup] C:\Users\Артём\git\DatingSpringBoot\DatingSpringBoot\target\recording.jfr
[5.316s][warning][os ] Unable to resolve PDH index: (230)
[5.318s][warning][os ] Please check the registry if this performance object/counter is disabled
[6.617s][warning][os ] Unable to resolve PDH index: (230)
[6.618s][warning][os ] Please check the registry if this performance object/counter is disabled
В итоге файл создается, но он пустой. Даже после принудительного завершения работы приложения (Ctrl + C).