Actions can be quickly debugged with action details. The method of printing action details is as follows.
As shown above, if trace is selected in the model breakpoint, the execution details of the action and the sub-action of the action call are printed when the breakpoint is executed.
As shown above, DebugContext can also be used in the action model, and the details of the action and its sub-actions will be printed after setting up.
In the code, you can manually control whether you want to print the details of action execution by setting DebugContext in the variable stack, as follows.
import org.xmeta.Thing; import org.xmeta.ActionContext; //Specify the context object as DebugContext in the stack layer in the action context def ac = new ActionContext(); ac.peek().setContextThing(new Thing("xworker.lang.context.DebugContext")); //Execute actions using an action context with DebugContext def action = world.getAction("_local.test.core.actions.context.TestDebugContext/@Begin"); action.run(ac);
2017-03-08 10:42:02,890 INFO (xworker.lang.context.DebugContext:47) - Begin, starting: _local.test.core.actions.context.TestDebugContext/@Begin 2017-03-08 10:42:02,891 INFO (xworker.lang.context.DebugContext:47) - run, starting: xworker.lang.actions.Begin/@actions1/@run 2017-03-08 10:42:02,892 INFO (xworker.lang.context.DebugContext:47) - createName, starting: _local.test.core.actions.context.TestDebugContext/@Begin/@actions/@createName 2017-03-08 10:42:02,892 INFO (xworker.lang.context.DebugContext:47) - run, starting: xworker.lang.actions.ValueFactory/@actions/@run 2017-03-08 10:42:02,892 INFO (xworker.lang.context.DebugContext:63) - run, finished, time: 0, return: XWorker 2017-03-08 10:42:02,893 INFO (xworker.lang.context.DebugContext:63) - createName, finished, time: 1, return: XWorker 2017-03-08 10:42:02,894 INFO (xworker.lang.context.DebugContext:47) - Println, starting: _local.test.core.actions.context.TestDebugContext/@Begin/@actions/@Println 2017-03-08 10:42:02,894 INFO (xworker.lang.context.DebugContext:47) - run, starting: xworker.lang.actions.log.PrintActions/@Println/@actions/@run 2017-03-08 10:42:02,894 INFO (xworker.lang.context.DebugContext:47) - getVar, starting: xworker.lang.actions.log.PrintActions/@Println/@actions/@getVar 2017-03-08 10:42:02,895 INFO (xworker.lang.context.DebugContext:47) - run, starting: xworker.lang.actions.ActionUtil/@GetData/@actions/@run 2017-03-08 10:42:02,896 INFO (xworker.lang.context.DebugContext:63) - run, finished, time: 1, return: XWorker 2017-03-08 10:42:02,896 INFO (xworker.lang.context.DebugContext:63) - getVar, finished, time: 2, return: XWorker 2017-03-08 10:42:02,897 INFO (xworker.lang.context.DebugContext:47) - getMessage, starting: xworker.lang.actions.log.PrintActions/@Println/@actions/@getMessage 2017-03-08 10:42:02,897 INFO (xworker.lang.context.DebugContext:47) - run, starting: xworker.lang.actions.ActionUtil/@GetString/@actions/@run 2017-03-08 10:42:02,897 INFO (xworker.lang.context.DebugContext:63) - run, finished, time: 0, return: null 2017-03-08 10:42:02,898 INFO (xworker.lang.context.DebugContext:63) - getMessage, finished, time: 1, return: null XWorker 2017-03-08 10:42:02,898 INFO (xworker.lang.context.DebugContext:63) - run, finished, time: 4, return: null 2017-03-08 10:42:02,899 INFO (xworker.lang.context.DebugContext:63) - Println, finished, time: 5, return: null 2017-03-08 10:42:02,899 INFO (xworker.lang.context.DebugContext:63) - run, finished, time: 8, return: null 2017-03-08 10:42:02,899 INFO (xworker.lang.context.DebugContext:63) - Begin, finished, time: 9, return: null
Copyright © 2007-2019 XWorker.org 版权所有 沪ICP备08000575号