Python Logging Good Practices
Logging library in python has been in standard library since a very long time. In many aspects, this logging framework bears similiarties with log4j libraries in Java. In this blog post, I will go over some of the good approaches when using python log formatting. Avoid using root logger Avoiding root logger provides the following benefits: Better descriptive names regarding where the log originated from. Helps during searching of logs Allows better log customization Many times, we find it quite easy to start logging using logging.info/logging.error methods. However, using any of the methods under logging module will result in root logger being invoked. Take a look at the examples below involving two modules: logger_usage.py and user_record.py ...