如何在Maven项目中为Flight Recorder添加启用标记? [英] How to add enable flag for Flight Recorder in Maven project?

查看:338
本文介绍了如何在Maven项目中为Flight Recorder添加启用标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将开始使用 Java Mission Control 5.3.0 .

我已经在我的网络应用的jetty.template中添加了 -XX:+ UnlockCommercialFeatures -XX:+ FlightRecorder .

I have added -XX:+UnlockCommercialFeatures -XX:+FlightRecorder into my web-app's jetty.template.

然后,我使用 mvn jetty:run 启动网络应用.

Then I start the web-app with mvn jetty:run.

但是当我启动 Flight Recorder 时,出现如下所示的弹出问题.

But while I was starting Flight Recorder I got the problem occurred pop-up as below.

'Start Flight Recording.. (Last attempt failed)' have encountered a problem.Commercial features are not enabled. In JDK7u4 and above,the JVM must be started with -XX:+UnlockCommercialFeatures -XX:+FlightRecorder .

而且我还尝试将以下标志添加到 pom.xml 中,但是它不起作用.

And I also try adding the flags as below into pom.xml but it doesn't work.

<jvmArgs>
    <jvmArg>-Xmx128m</jvmArg>
    <jvmArg>-Xms128m</jvmArg>
    <jvmArg>-XX:MaxPermSize=512m</jvmArg>
    <jvmArg>-XX:+UnlockCommercialFeatures</jvmArg>
    <jvmArg>-XX:+FlightRecorder</jvmArg>
    <jvmArg>-XX:StartFlightRecording=duration=160s,delay=20s,settings=profile,filename=target/recording.jfr</jvmArg>
</jvmArgs>

我该怎么做才能在Web应用程序上启用Flight Recorder?

What should I do for enable Flight Recorder on my web-app?

推荐答案

如果您使用的是来自jdk的jcmd命令,则可以通过以下方式启用JFR:

If you are using jcmd command from jdk, then could enable JFR via:

jcmd 31118 VM.unlock_commercial_features

然后使用JFR.

例如

jcmd 31118 JFR.start name=a

这篇关于如何在Maven项目中为Flight Recorder添加启用标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆