# Debug Statements in Paraview

**URL:** https://discourse.paraview.org/t/debug-statements-in-paraview/12006
**Category:** Development
**Created:** [May 3, 2023, 1:41am UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006 "2023-05-03T01:41:10Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 3, 2023, 1:41am UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/1 "2023-05-03T01:41:10Z")

</div>

Hi, I am creating my own Filter, so I was wondering if there is a way to print Debug statements in between c++ code? So that when I load the plugin and apply my filter I can see those print statements?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 3, 2023, 7:15am UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/2 "2023-05-03T07:15:27Z")

</div>

use `vtkWarningMacro` if cout doesnt work for you.

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 3, 2023, 4:01pm UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/3 "2023-05-03T16:01:11Z")

</div>

Okay, thanks!

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [May 3, 2023, 4:08pm UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/4 "2023-05-03T16:08:08Z")

</div>

I personally prefer `vtkLog` macros over `vtkWarning...`, discussed [here](https://vtk.org/doc/nightly/html/classvtkLogger.html#details). They make it a little easier to format the generated text, plus support different log levels too.

Also note, if trying to debug your filter in parallel, `pvserver` supports command line arguments that can save output logs to separate files per rank – thus avoid clobbering output from multiple ranks.

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 3, 2023, 4:13pm UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/5 "2023-05-03T16:13:32Z")

</div>

If I use vtkLog and use this command to run paraview, will these logs gets printed to the same paraview.log file?

```auto
paraview.exe -l=C:\Users\msaad\paraview.log,TRACE

```

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 3, 2023, 4:15pm UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/6 "2023-05-03T16:15:36Z")

</div>

> [@utkarsh.ayachit](#):
>
> Also note, if trying to debug your filter in parallel, `pvserver` supports command line arguments that can save output logs to separate files per rank – thus avoid clobbering output from multiple ranks.

Didn’t quite get you. I am uploading .dll file of my filter through `Manage Plugin` (for now) and then using my filter normally. I want to see the input and output data and other messages that I want to print for debugging.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [May 3, 2023, 4:23pm UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/7 "2023-05-03T16:23:52Z")

</div>

> [@Muhammad\_Saad\_Atique](#):
>
> If I use vtkLog and use this command to run paraview, will these logs gets printed to the same paraview.log file?

Yes.

> [@Muhammad\_Saad\_Atique](#):
>
> Didn’t quite get you…

Since you’re not running a separate `pvserver`, you can ignore my comment. Essentially, similar to how you are doing `paraview.exe -l=...paraview.log,TRACE`, you can run a parallel pvserver as `mpirun -np <num ranks> pvserver -l=...pvserver.log,TRACE` and you’ll get log files names `pvserver.0.log`, `pvserver.1.log`, etc. for each pvserver process.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 3, 2023, 4:31pm UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/8 "2023-05-03T16:31:41Z")

</div>

@utkarsh.ayachit : Afaik, vtkLog does not go to the output window, does it ?

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [May 3, 2023, 4:43pm UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/9 "2023-05-03T16:43:26Z")

</div>

Hmm, I can’t recall…it probably doesn’t. Note, the [Log Viewer](https://www.kitware.com/paraviews-advanced-logging-user-interface/) is probably more useful for such debugging anyways.

Logging to file is always a better option when developing a new filter, though; even if the application crashes, you have the logs saved out to a file to inspect and diagnose the issue.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [May 4, 2023, 1:26am UTC](https://discourse.paraview.org/t/debug-statements-in-paraview/12006/10 "2023-05-04T01:26:26Z")

</div>

> [@mwestphal](#):
>
> @utkarsh.ayachit : Afaik, vtkLog does not go to the output window, does it ?

It does not.
