# writing to container logs from Python

**URL:** <https://forum.ansible.com/t/writing-to-container-logs-from-python/36957>\
**Category:** AWX Project\
**Tags:** awx, kubernetes\
**Created:** [August 6, 2022, 12:37am UTC](https://forum.ansible.com/t/writing-to-container-logs-from-python/36957 "2022-08-06T00:37:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Erickson](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@Mike\_Erickson](https://forum.ansible.com/u/Mike_Erickson)\
**Post date:** [August 6, 2022, 12:37am UTC](https://forum.ansible.com/t/writing-to-container-logs-from-python/36957/1 "2022-08-06T00:37:44Z")

</div>

I’m using AWX 20.1.0 on Kuberenetes 1.23

I have some custom python modules and I’m hoping to use the standard Python logger to write to the container logs. This would allow me to then view my logs in real time from the kubernetes dashboard as my jobs run plus they would also automatically be picked up by my log collector. I don’t want the output to be included in the AWX job output.  
I tried simply writing to stdout but my messages never show up. I suspect this is partly by design because of the callback plugin but I also thought this would be a simple/common thing to do. Any ideas?

---

<div class="post-metadata">

**Author:** ![mani3887](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mani3887](https://forum.ansible.com/u/mani3887)\
**Post date:** [August 11, 2022, 6:47pm UTC](https://forum.ansible.com/t/writing-to-container-logs-from-python/36957/2 "2022-08-11T18:47:33Z")

</div>

Following as I have a similar use case.

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [August 17, 2022, 2:57pm UTC](https://forum.ansible.com/t/writing-to-container-logs-from-python/36957/3 "2022-08-17T14:57:00Z")

</div>

Hi,  
Custom python modules are run in the container through ansible, which is probably why your messages never show up. Visiting the ansible specific mailing list instead of this one might give you some better results.  
AWX Team
