# module.debug

**URL:** <https://forum.ansible.com/t/module-debug/28179>\
**Category:** Ansible Developer\
**Created:** [July 27, 2018, 2:19pm UTC](https://forum.ansible.com/t/module-debug/28179 "2018-07-27T14:19:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yaakov.kuperman](https://avatars.discourse-cdn.com/v4/letter/y/45deac/32.png) [@yaakov.kuperman](https://forum.ansible.com/u/yaakov.kuperman)\
**Post date:** [July 27, 2018, 2:19pm UTC](https://forum.ansible.com/t/module-debug/28179/1 "2018-07-27T14:19:46Z")

</div>

I notice that some modules use ‘module.debug’ for logging, but I can’t find any docs on it. I skimmed the function definition in AnsibleModule and it appears that when the module has the \_debug attribute set, it tries to log to syslog. I’m trying to get this to work in ansible-test, but I can’t make it happen, even when I pass --debug in. How does this feature work?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 27, 2018, 4:50pm UTC](https://forum.ansible.com/t/module-debug/28179/2 "2018-07-27T16:50:40Z")

</div>

short answer: ANSIBLE\_DEBUG=1 activates it

long answer:

This is integrated into AnsibleModule  
(lib/ansible/module\_utils/basic.py), which has a 'debug' method, this  
method will write to the local syslog/systemd.

The method is activated when the module receives an `_ansible_debug`  
parameter that is True, which ansible itself sends if 'debug is  
enabled' via the configuration (env var above or in ansible.cfg).  
It will turn off if you use no\_log or have the no\_target\_syslog  
setting to avoid disclosure.

I hope that helps

---

<div class="post-metadata">

**Author:** ![yaakov.kuperman](https://avatars.discourse-cdn.com/v4/letter/y/45deac/32.png) [@yaakov.kuperman](https://forum.ansible.com/u/yaakov.kuperman)\
**Post date:** [July 27, 2018, 5:32pm UTC](https://forum.ansible.com/t/module-debug/28179/3 "2018-07-27T17:32:16Z")

</div>

That’s very helpful, thanks!
