# Debug logging in modules

**URL:** <https://forum.ansible.com/t/debug-logging-in-modules/15326>\
**Category:** Ansible Project\
**Created:** [May 25, 2014, 6:14am UTC](https://forum.ansible.com/t/debug-logging-in-modules/15326 "2014-05-25T06:14:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Johren](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Martin\_Johren](https://forum.ansible.com/u/Martin_Johren)\
**Post date:** [May 25, 2014, 6:14am UTC](https://forum.ansible.com/t/debug-logging-in-modules/15326/1 "2014-05-25T06:14:50Z")

</div>

Hi,

after some searching I did not find anything appropriate: I just want to log some debug information in my on new module in libraries/cloud, so my first attempt was to use vv, but when I import it

from ansible.callbacks import vv, vvv

it’s always complaining about

`

Traceback (most recent call last):  
File “/Users/m.joehren/.ansible\_module\_generated”, line 72, in   
from ansible.callbacks import vv, vvv  
File “/Users/m.joehren/matlockx/ansible/lib/ansible/callbacks.py”, line 18, in   
import utils  
File “/Users/m.joehren/matlockx/ansible/lib/ansible/utils/ **init**.py”, line 29, in   
from ansible.utils.display\_functions import \*  
File “/Users/m.joehren/matlockx/ansible/lib/ansible/utils/display\_functions.py”, line 22, in   
from ansible.callbacks import display  
ImportError: cannot import name display

`

Is it a python thing that i’m missing here (i’m more or less python beginner)?  
Anyhow, how should debug logging in modules be done? And when I use vv, how can I pass that to the test-module command on the command line?

Thanks in advance,

Martin

---

<div class="post-metadata">

**Author:** ![Martin\_Johren](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Martin\_Johren](https://forum.ansible.com/u/Martin_Johren)\
**Post date:** [May 25, 2014, 11:48am UTC](https://forum.ansible.com/t/debug-logging-in-modules/15326/2 "2014-05-25T11:48:57Z")

</div>

K, found the import issue. Just had to add it by myself in my module.  
I’m still interested in getting to know whether it is the preferred way to log debug information and how to use it when running test\_module.

Thx

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 25, 2014, 9:07pm UTC](https://forum.ansible.com/t/debug-logging-in-modules/15326/3 "2014-05-25T21:07:39Z")

</div>

“I’m still interested in getting to know whether it is the preferred way to log debug information and how to use it when running test\_module.”

I do a fair amount of print output actually.

But here’s also a blog post I wrote previously: [http://michaeldehaan.net/post/35403909347/tips-on-using-debuggers-with-ansible](http://michaeldehaan.net/post/35403909347/tips-on-using-debuggers-with-ansible)

FWIW, I’d suggest you join ansible-devel for development topics, trying to get that one a bit more active and this is probably a bit involved for ansible-project.

Thanks!

---

<div class="post-metadata">

**Author:** ![Martin\_Johren](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Martin\_Johren](https://forum.ansible.com/u/Martin_Johren)\
**Post date:** [May 25, 2014, 9:09pm UTC](https://forum.ansible.com/t/debug-logging-in-modules/15326/4 "2014-05-25T21:09:01Z")

</div>

Will do. Sorry for that. Missed it.
