Printing log from flow.xml

我怕爱的太早我们不能终老 提交于 2019-11-29 16:27:27
Selwyn

You can add an on-exit tag to the end of the 'decision-state' and call any service methods, spring beans, or static methods on the classpath.

Try this (untested):

<decision-state id="checkPermissin">    
    <if test="requestParameters.canApprove" then="approve" else="warning" />
   <on-exit>
        <evaluate expression="T(org.apache.log4j.Logger).getLogger('someLogger').info(requestParameters.canApprove)"/>
   </on-exit>
</decision-state>

The above solution is more of a hack to fulfill what you are asking for. The "proper" way to log this is to extend a FlowExecutionListenerAdapter and to listen for your current flow + decision-state id "checkPermissin" then log whatever you desire about that flow but it would involve more setup/coding outside the flow.xml file. (see: Catch "dead" session in Spring webflow: the example is for catching exceptions but can easily be adapted for logging anything in a flow)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!