# Logging to readable format

**URL:** <https://forum.ansible.com/t/logging-to-readable-format/32449>\
**Category:** Ansible Project\
**Created:** [March 12, 2020, 1:52pm UTC](https://forum.ansible.com/t/logging-to-readable-format/32449 "2020-03-12T13:52:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RayO1](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@RayO1](https://forum.ansible.com/u/RayO1)\
**Post date:** [March 12, 2020, 1:52pm UTC](https://forum.ansible.com/t/logging-to-readable-format/32449/1 "2020-03-12T13:52:49Z")

</div>

Hi. I have a very basic cisco IOS playbook i’m working on and when I log the output to a file I cannot read the format. I read a few threads that mention enabling a callback option in the ansible.cfg but that does not seem to work. Does anyone know how I can accomplish logging to a readable text?

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [March 12, 2020, 2:04pm UTC](https://forum.ansible.com/t/logging-to-readable-format/32449/2 "2020-03-12T14:04:15Z")

</div>

> Hi. I have a very basic cisco IOS playbook i'm working on and when I log the output to a file I cannot read the format.  
> I read a few threads that mention enabling a callback option in the ansible.cfg but that does not seem to work. Does  
> anyone know how I can accomplish logging to a readable text?

Ansible stringifies the list object output1.stdout\_lines, but you want to print each element of this list to line  
in the file.

Using "{{ output1.stdout\_lines | join('\n') }}" should do the trick.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![RayO1](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@RayO1](https://forum.ansible.com/u/RayO1)\
**Post date:** [March 12, 2020, 2:51pm UTC](https://forum.ansible.com/t/logging-to-readable-format/32449/3 "2020-03-12T14:51:24Z")

</div>

Hi Stefan,

Thanks for the reply. Unfortunately though it doesn’t look like that worked. I replaced the below line with the entry you provided but it’s still printing in a bad format

copy: content=“{{ output1.stdout\_lines | join(‘\n’) }}”

Any other ideas?

---

<div class="post-metadata">

**Author:** ![RayO1](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@RayO1](https://forum.ansible.com/u/RayO1)\
**Post date:** [March 12, 2020, 8:27pm UTC](https://forum.ansible.com/t/logging-to-readable-format/32449/4 "2020-03-12T20:27:57Z")

</div>

Anyone have any thoughts on this?

---

<div class="post-metadata">

**Author:** ![RayO1](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@RayO1](https://forum.ansible.com/u/RayO1)\
**Post date:** [March 12, 2020, 9:20pm UTC](https://forum.ansible.com/t/logging-to-readable-format/32449/5 "2020-03-12T21:20:20Z")

</div>

I was able to resolve this finding the below thread. In my case I had to alter the config slightly to the below. This was to merge the text together no space and eliminate “\_lines”

- name: print result  
debug:  
var: output1.stdout\_lines

- name: copy output to file

copy: content=“{{**output1.stdout|join(“\n”**)}}” dest=/home/userfolder/ansible/cisco/logs/{{ inventory\_hostname }}.txt

[https://groups.google.com/forum/#!topic/ansible-project/4cJ7ho8uiAA](https://groups.google.com/forum/#!topic/ansible-project/4cJ7ho8uiAA)
