import{_ as t,o as l,c as o,a as e,b as a,e as n,d as i,r as d}from"./app.6c27e557.js";const c={},r=e("h1",{id:"options",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#options","aria-hidden":"true"},"#"),n(" options")],-1),u={href:"https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-options",target:"_blank",rel:"noopener noreferrer"},p=e("code",null,"options",-1),b=n("\u5728\u7EBF\u6559\u7A0B"),m=e("div",{class:"custom-container tip"},[e("p",{class:"custom-container-title"},"\u63D0\u793A"),e("p",null,"\u5168\u5C40\u5F00\u5173")],-1),v=e("thead",null,[e("tr",null,[e("th",null,"\u540D\u79F0"),e("th",null,"\u9ED8\u8BA4\u503C"),e("th",null,"\u63CF\u8FF0")])],-1),h=e("tr",null,[e("td",null,"unsafe"),e("td",null,"false"),e("td",null,"\u662F\u5426\u652F\u6301\u5BF9\u7CFB\u7EDF\u7EA7\u522B\u7684\u7C7B\u8FDB\u884C\u589E\u5F3A\uFF0C\u6253\u5F00\u8BE5\u5F00\u5173\u53EF\u80FD\u5BFC\u81F4\u628A JVM \u641E\u6302\uFF0C\u8BF7\u614E\u91CD\u9009\u62E9\uFF01")],-1),f=e("tr",null,[e("td",null,"dump"),e("td",null,"false"),e("td",null,[n("\u662F\u5426\u652F\u6301\u88AB\u589E\u5F3A\u4E86\u7684\u7C7B dump \u5230\u5916\u90E8\u6587\u4EF6\u4E2D\uFF0C\u5982\u679C\u6253\u5F00\u5F00\u5173\uFF0Cclass \u6587\u4EF6\u4F1A\u88AB dump \u5230"),e("code",null,"/${application working dir}/arthas-class-dump/"),n("\u76EE\u5F55\u4E0B\uFF0C\u5177\u4F53\u4F4D\u7F6E\u8BE6\u89C1\u63A7\u5236\u53F0\u8F93\u51FA")])],-1),k=e("tr",null,[e("td",null,"batch-re-transform"),e("td",null,"true"),e("td",null,"\u662F\u5426\u652F\u6301\u6279\u91CF\u5BF9\u5339\u914D\u5230\u7684\u7C7B\u6267\u884C retransform \u64CD\u4F5C")],-1),g=e("tr",null,[e("td",null,"json-format"),e("td",null,"false"),e("td",null,"\u662F\u5426\u652F\u6301 json \u5316\u7684\u8F93\u51FA")],-1),_=e("tr",null,[e("td",null,"disable-sub-class"),e("td",null,"false"),e("td",null,"\u662F\u5426\u7981\u7528\u5B50\u7C7B\u5339\u914D\uFF0C\u9ED8\u8BA4\u5728\u5339\u914D\u76EE\u6807\u7C7B\u7684\u65F6\u5019\u4F1A\u9ED8\u8BA4\u5339\u914D\u5230\u5176\u5B50\u7C7B\uFF0C\u5982\u679C\u60F3\u7CBE\u786E\u5339\u914D\uFF0C\u53EF\u4EE5\u5173\u95ED\u6B64\u5F00\u5173")],-1),x=e("td",null,"support-default-method",-1),w=e("td",null,"true",-1),E=n("\u662F\u5426\u652F\u6301\u5339\u914D\u5230 default method\uFF0C \u9ED8\u8BA4\u4F1A\u67E5\u627E interface\uFF0C\u5339\u914D\u91CC\u9762\u7684 default method\u3002\u53C2\u8003 "),j={href:"https://github.com/alibaba/arthas/issues/1105",target:"_blank",rel:"noopener noreferrer"},y=n("#1105"),T=e("tr",null,[e("td",null,"save-result"),e("td",null,"false"),e("td",null,[n("\u662F\u5426\u6253\u5F00\u6267\u884C\u7ED3\u679C\u5B58\u65E5\u5FD7\u529F\u80FD\uFF0C\u6253\u5F00\u4E4B\u540E\u6240\u6709\u547D\u4EE4\u7684\u8FD0\u884C\u7ED3\u679C\u90FD\u5C06\u4FDD\u5B58\u5230"),e("code",null,"~/logs/arthas-cache/result.log"),n("\u4E2D")])],-1),O=e("tr",null,[e("td",null,"job-timeout"),e("td",null,"1d"),e("td",null,"\u5F02\u6B65\u540E\u53F0\u4EFB\u52A1\u7684\u9ED8\u8BA4\u8D85\u65F6\u65F6\u95F4\uFF0C\u8D85\u8FC7\u8FD9\u4E2A\u65F6\u95F4\uFF0C\u4EFB\u52A1\u81EA\u52A8\u505C\u6B62\uFF1B\u6BD4\u5982\u8BBE\u7F6E 1d, 2h, 3m, 25s\uFF0C\u5206\u522B\u4EE3\u8868\u5929\u3001\u5C0F\u65F6\u3001\u5206\u3001\u79D2")],-1),A=e("tr",null,[e("td",null,"print-parent-fields"),e("td",null,"true"),e("td",null,"\u662F\u5426\u6253\u5370\u5728 parent class \u91CC\u7684 filed")],-1),V=e("tr",null,[e("td",null,"verbose"),e("td",null,"false"),e("td",null,"\u662F\u5426\u6253\u5370\u66F4\u591A\u8BE6\u7EC6\u4FE1\u606F")],-1),N=e("tr",null,[e("td",null,"strict"),e("td",null,"true"),e("td",null,"\u662F\u5426\u542F\u7528 strict \u6A21\u5F0F")],-1),M=i(`
$ options
LEVEL TYPE NAME VALUE SUMMARY DESCRIPTION
-------------------------------------------------------------------------------------------------------
0 boolea unsafe false Option to support sy This option enables to proxy functionality
n stem-level class of JVM classes. Due to serious security r
isk a JVM crash is possibly be introduced.
Do not activate it unless you are able to
manage.
1 boolea dump false Option to dump the e This option enables the enhanced classes t
n nhanced classes o be dumped to external file for further d
e-compilation and analysis.
1 boolea batch-re-tra true Option to support ba This options enables to reTransform classe
n nsform tch reTransform Clas s with batch mode.
s
2 boolea json-format false Option to support JS This option enables to format object outpu
n ON format of object t with JSON when -x option selected.
output
1 boolea disable-sub- false Option to control in This option disable to include sub class w
n class clude sub class when hen matching class.
class matching
1 boolea support-defa true Option to control in This option disable to include default met
n ult-method clude default method hod in interface when matching class.
in interface when c
lass matching
1 boolea save-result false Option to print comm This option enables to save each command's
n and's result to log result to log file, which path is \${user.
file home}/logs/arthas-cache/result.log.
2 String job-timeout 1d Option to job timeou This option setting job timeout,The unit c
t an be d, h, m, s for day, hour, minute, se
cond. 1d is one day in default
1 boolea print-parent true Option to print all This option enables print files in parent
n -fields fileds in parent cla class, default value true.
ss
1 boolea verbose false Option to print verb This option enables print verbose informat
n ose information ion, default value false.
1 boolea strict true Option to strict mod By default, strict mode is true, not allow
n e ed to set object properties. Want to set o
bject properties, execute \`options strict
false\`
$ options json-format
LEVEL TYPE NAME VALUE SUMMARY DESCRIPTION
--------------------------------------------------------------------------------------------
2 bool json-format false Option to support This option enables to format object
ean JSON format of obj output with JSON when -x option selec
ect output ted.
\u63D0\u793A
\u9ED8\u8BA4\u60C5\u51B5\u4E0Bjson-format
\u4E3A false\uFF0C\u5982\u679C\u5E0C\u671Bwatch
/tt
\u7B49\u547D\u4EE4\u7ED3\u679C\u4EE5 json \u683C\u5F0F\u8F93\u51FA\uFF0C\u5219\u53EF\u4EE5\u8BBE\u7F6Ejson-format
\u4E3A true\u3002
\u4F8B\u5982\uFF0C\u60F3\u6253\u5F00\u6267\u884C\u7ED3\u679C\u5B58\u65E5\u5FD7\u529F\u80FD\uFF0C\u8F93\u5165\u5982\u4E0B\u547D\u4EE4\u5373\u53EF\uFF1A
$ options save-result true
NAME BEFORE-VALUE AFTER-VALUE
----------------------------------------
save-result false true
\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0Cwatch
/trace
/tt
/trace
/monitor
\u7B49\u547D\u4EE4\u4E0D\u652F\u6301java.*
package \u4E0B\u7684\u7C7B\u3002\u53EF\u4EE5\u8BBE\u7F6Eunsafe
\u4E3A true\uFF0C\u5219\u53EF\u4EE5\u589E\u5F3A\u3002
$ options unsafe true
NAME BEFORE-VALUE AFTER-VALUE
-----------------------------------
unsafe false true
$ watch java.lang.invoke.Invokers callSiteForm
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 61 ms, listenerId: 1
\u63D0\u793A
since 3.6.0
\u5BF9\u4E8E\u65B0\u7528\u6237\uFF0C\u5728\u7F16\u5199 ognl \u8868\u8FBE\u5F0F\u65F6\uFF0C\u53EF\u80FD\u4F1A\u51FA\u73B0\u8BEF\u7528\u3002
\u6BD4\u5982\u5BF9\u4E8EStudent
\uFF0C\u5224\u65AD\u5E74\u9F84\u7B49\u4E8E 18 \u65F6\uFF0C\u53EF\u80FD\u6761\u4EF6\u8868\u8FBE\u5F0F\u4F1A\u8BEF\u5199\u4E3Atarget.age=18
\uFF0C\u8FD9\u4E2A\u8868\u8FBE\u5F0F\u5B9E\u9645\u4E0A\u662F\u628A\u5F53\u524D\u5BF9\u8C61\u7684age
\u8BBE\u7F6E\u4E3A 18 \u4E86\u3002\u6B63\u786E\u7684\u5199\u6CD5\u662Ftarget.age==18
\u3002
\u4E3A\u4E86\u9632\u6B62\u51FA\u73B0\u7C7B\u4F3C\u4E0A\u9762\u7684\u8BEF\u7528\uFF0CArthas \u9ED8\u8BA4\u542F\u7528strict
\u6A21\u5F0F\uFF0C\u5728ognl
\u8868\u8FBE\u5F0F\u91CC\uFF0C\u7981\u6B62\u66F4\u65B0\u5BF9\u8C61\u7684 Property \u6216\u8005\u8C03\u7528setter
\u51FD\u6570\u3002
\u4EE5MathGame
\u4E3A\u4F8B\uFF0C\u4F1A\u51FA\u73B0\u4EE5\u4E0B\u7684\u9519\u8BEF\u63D0\u793A\u3002
$ watch demo.MathGame primeFactors 'target' 'target.illegalArgumentCount=1'
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 206 ms, listenerId: 1
watch failed, condition is: target.illegalArgumentCount=1, express is: target, By default, strict mode is true, not allowed to set object properties. Want to set object properties, execute \`options strict false\`, visit /Users/admin/logs/arthas/arthas.log for more details.
\u7528\u6237\u5982\u679C\u786E\u5B9A\u8981\u5728ognl
\u8868\u8FBE\u5F0F\u91CC\u66F4\u65B0\u5BF9\u8C61\uFF0C\u53EF\u4EE5\u6267\u884Coptions strict false
\uFF0C\u5173\u95EDstrict
\u6A21\u5F0F\u3002