Python Forum
Logging in many submodules - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Logging in many submodules (/thread-38167.html)



Logging in many submodules - veysel - Sep-10-2022

Let's say I have 20 modules, and I want to log all messages in this modules.

For example

Project
-- package1
-- test1.py
-- test2.py

-- package2
-- test1.py
-- test2.py
...
...

If I do
logging.getLogger(__name__)
in every modules, is this good practise ? Or do I use different method ? Also I will log to two files in every modules. There is one main log file, every module will write messages to main log file and also every module will write own messages to a specif file. I am trying to log efficiently.

What is your recommendation ?