Skip to content

Commit 0293c44

Browse files
Merge pull request #626 from mulesoft/W-21953173-Address-Jack-feedback-CP
W-21953173-Address-Jack-feedback-CP
2 parents b7bbb7a + cc944b8 commit 0293c44

2 files changed

Lines changed: 67 additions & 5 deletions

File tree

modules/ROOT/pages/int-debug-mule-apps.adoc

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ For example, trigger an HTTP Listener or configure a Scheduler component.
3131
* xref:start-acb.adoc[Set up and access the web or desktop IDE].
3232
* xref:int-create-integrations.adoc[Create an integration].
3333

34-
== Debug Console Overview
34+
[[debugger-view-overview]]
35+
== Debugger View Overview
3536

3637
image::debugger-view.png["Elements of the debugger view"]
3738

@@ -46,13 +47,15 @@ The Mule event includes message payload and attribute details, as well as Mule v
4647
. *Run and Debug* (MuleSoft) icon: Opens the *Run and Debug* panel, where you can click *Start Debugging (F5)* and find debugging information.
4748
+
4849
Keyboard shortcut: Cmd+Shift+d (Mac) or Ctrl+Shift+d (Windows)
49-
. *Watch* panel: Helps you evaluate variables and expressions.
50+
. *Watch* panel: Pin <<evaluate-dw-watch,DataWeave expressions>> that re-evaluate whenever execution pauses.
5051
. *Call Stack* panel: Identifies the functions or procedures that are currently in the stack.
51-
. *Breakpoints* panel: Lists all breakpoints in your Mule application.
52+
. *Breakpoints* panel: Lists breakpoints by file and line, and includes <<exception-breakpoints,*All Exceptions*>> to stop when any exception is thrown.
5253
. *Terminal* console: Displays the output of the Maven build process and the results of the deployment to the embedded Mule Runtime engine.
5354
. *Breakpoint* icon: Identifies a line in the configuration XML to pause execution of the flow so that you can check for and fix any issues.
5455
. *Breakpoint* icon: Identifies a component that contains one or more breakpoints.
5556

57+
Open the *Debug Console* tab in the panel area to <<evaluate-dw-debug-console,evaluate DataWeave>> while execution is paused. See <<evaluate-dw-while-debugging>>.
58+
5659

5760
[[add-breakpoint]]
5861
== Add a Breakpoint
@@ -116,7 +119,33 @@ A breakpoint icon appears on the component and in the configuration XML for that
116119
+
117120
When execution reaches the breakpoint, processing pauses so you can inspect variables, payloads, and the execution state in the Debug panel.
118121

119-
NOTE: Batch execution is concurrent. Multiple record blocks can be processed in parallel, so breakpoints can trigger on different threads. The Debug panel displays each thread context separately so you can inspect each execution path.
122+
NOTE: Batch execution is concurrent. Multiple record blocks can be processed in parallel, so breakpoints can trigger on different threads. The Debug panel displays each thread context so you can inspect each execution path.
123+
124+
[[conditional-breakpoint]]
125+
== Set a Conditional Breakpoint
126+
127+
A conditional breakpoint uses a DataWeave expression, so execution pauses at that line only when the expression evaluates to `true`.
128+
129+
To set or change a breakpoint condition:
130+
131+
. Add a breakpoint in the configuration XML. See <<add-breakpoint>>.
132+
. Right-click the breakpoint indicator in the gutter for that line.
133+
. Select *Edit Breakpoint*.
134+
. In the breakpoint editor, enter a DataWeave expression that uses the current Mule event.
135+
136+
The gutter context menu for a breakpoint also includes *Remove Breakpoint*, *Disable Breakpoint*, and *Run to Line*.
137+
138+
To review a condition later, hover over the breakpoint in the gutter. A tooltip shows the configured expression in the form `Condition:` followed by your DataWeave expression.
139+
140+
[[exception-breakpoints]]
141+
== Stop When an Exception Is Thrown
142+
143+
You can configure the debugger to pause whenever any exception is thrown, which helps you inspect failures without adding breakpoints to every path.
144+
145+
. Open *Run and Debug*.
146+
. In the *BREAKPOINTS* section, enable *All Exceptions*.
147+
+
148+
If you enable *All Exceptions*, the debugger pauses as soon as an exception is thrown during a debug session.
120149

121150
[[run-debug-mode]]
122151
== Run Your Application in Debug Mode
@@ -211,6 +240,34 @@ Stop and restart the application without packaging new dependencies, such as new
211240
+
212241
Stop execution of the application. The next debugging session that you start packages the application with any new dependencies.
213242

243+
[[evaluate-dw-while-debugging]]
244+
== Evaluate DataWeave While Debugging
245+
246+
While execution is paused, you can run DataWeave against the current Mule event from the *Debug Console* or from pinned entries in the *Watch* panel. For the variables available in those expressions, see xref:dataweave::dataweave-variables-context.adoc[Predefined Mule event variables].
247+
248+
[[evaluate-dw-debug-console]]
249+
=== Use the Debug Console
250+
251+
. Start a debug session and pause execution at a breakpoint or after a step. See <<run-debug-mode>> and <<debug-toolbar>>.
252+
. Open the *Debug Console* tab, or choose *View* > *Debug Console*.
253+
. Ensure the input is set to *Expression*. Type a DataWeave expression and press Enter to evaluate it against the current message, attributes, variables, and other values visible to the debugger at the pause.
254+
+
255+
The console shows each expression you run and its evaluated result for the current pause.
256+
257+
The *Debug Console* is suited to check if needed as you step through a flow.
258+
259+
[[evaluate-dw-watch]]
260+
=== Use the Watch Panel
261+
262+
. Open the *Watch* panel in the *Run and Debug* sidebar.
263+
. Add an entry with *+* and enter a DataWeave expression.
264+
+
265+
Whenever execution pauses, the debugger reevaluates each watch expression and shows the result next to the expression, similar to the *Debug Console*.
266+
+
267+
Watch expressions typically persist for later debug sessions in the same workspace, so you can keep inspecting the same values across runs.
268+
269+
The *Watch* panel is suited to values you want to track on every pause without retyping them.
270+
214271
[[hot-deploy]]
215272
== Perform a Hot Deploy When Debugging
216273

@@ -232,3 +289,8 @@ image::deb-hot-deploy.png["Hot-deploy (lightning) icon in a running Mule applica
232289
To stop your debug session, in the *Run and Debug* panel, click the image:icon-stop.png["",15,15] (*Stop*) icon.
233290

234291
The status bar no longer indicates that the application is running.
292+
293+
== See Also
294+
295+
* xref:dataweave::dataweave-variables-context.adoc[]
296+
* xref:int-configure-dw-expressions.adoc[]

modules/ROOT/pages/int-test-munit.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ Run your test in debug mode after adding breakpoints to the XML for your tests o
451451
. {open-project}
452452
. Add breakpoints to the XML for the Mule application or test suites.
453453
+
454-
For guidance with breakpoints and the Mule event, see xref:int-debug-mule-apps.adoc[].
454+
For guidance with breakpoints, the Mule event, DataWeave in the *Watch* panel and *Debug Console*, conditional breakpoints, and exception breakpoints, see xref:int-debug-mule-apps.adoc[].
455455
. Run your test with a debugging command using one of the following options:
456456

457457
* From the *Testing* panel, click image:anypoint-code-builder::icon-munit-run-debug.png["",18,18] (*Debug test*) at any level (all tests, all tests in a suite, or a single test).

0 commit comments

Comments
 (0)