You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the content you want to watch, written by ognl. 由于这里是被ognl 处理的,所以可以支持ognl的表达式去处理哦。
[arthas@21289]$ help watch
USAGE:
watch [-b] [-e] [-x <value>] [-f] [-h] [-n <value>] [-E] [-M <value>] [-s] class-pattern method-pattern
express [condition-express]
SUMMARY:
Display the input/output parameter, return object, and thrown exception of specified method invocation
The express may be one of the following expression (evaluated dynamically):
target : the object
clazz : the object's class
method : the constructor or method
params : the parameters array of method
params[0..n] : the element of parameters array
returnObj : the returned object of method
throwExp : the throw exception of method
isReturn : the method ended by return
isThrow : the method ended by throwing exception
#cost : the execution time in ms of method invocation
Examples:
watch -b org.apache.commons.lang.StringUtils isBlank params
watch -f org.apache.commons.lang.StringUtils isBlank returnObj
watch org.apache.commons.lang.StringUtils isBlank '{params, target, returnObj}' -x 2
watch -bf *StringUtils isBlank params
watch *StringUtils isBlank params[0]
watch *StringUtils isBlank params[0] params[0].length==1
watch *StringUtils isBlank params '#cost>100'
watch -E -b org\.apache\.commons\.lang\.StringUtils isBlank params[0]
WIKI:
https://alibaba.github.io/arthas/watch
OPTIONS:
-b, --before Watch before invocation
-e, --exception Watch after throw exception
-x, --expand <value> Expand level of object (1 by default)
-f, --finish Watch after invocation, enable by default
-h, --help this help
-n, --limits <value> Threshold of execution times
-E, --regex Enable regular expression to match (wildcard matching by default)
-M, --sizeLimit <value> Upper size limit in bytes for the result (10 * 1024 * 1024 by default)
-s, --success Watch after successful invocation
<class-pattern> The full qualified class name you want to watch
<method-pattern> The method name you want to watch
<express> the content you want to watch, written by ognl.
Examples:
params
params[0]
'params[0]+params[1]'
'{params[0], target, returnObj}'
returnObj
throwExp
target
clazz
method
<condition-express> Conditional expression in ognl style, for example:
TRUE : 1==1
TRUE : true
FALSE : false
TRUE : 'params.length>=0'
FALSE : 1==2
Watch Spring Context Invoke Method Field 命令
右键选择需要调用的spring bean 的方法或者 字段的信息
获取命令
没有错,这个和 Static spring context invoke method field 一样的,只是这里的获取spring context的路径不一样,这里通过watch 去获取spring context ** watch 必须要被触发一次才能进行调用哦**
watch -x 3 -n 3 org.springframework.web.servlet.DispatcherServlet doDispatch '@org.springframework.web.context.support.WebApplicationContextUtils@getWebApplicationContext(params[0].getServletContext()).getBean("controllerTest").test()'
触发调用一下这个接口,必须要触发一下接口的调用,任意接口都可以,由于这里watch的是org.springframework.web.servlet.DispatcherServlet doDispatch 因此都可以
效果如下
help watch
the content you want to watch, written by ognl. 由于这里是被ognl 处理的,所以可以支持ognl的表达式去处理哦。
可以参考学习的网址
ognl 官方
ognl 特殊用法
ognl 最佳实践
other
这里watch的是接口的分发的入口类,一般只要watch 执行 ognl的spring context 表达式都会成功的,调用方法要注意安全哦。
The text was updated successfully, but these errors were encountered: