Adv concepts in Python
1.Logging
- Basic logging basicConfig
- Creating Logger object
- Using external config, and using dictConfig and fileConfig()
- All logging concepts covered here:
More notes available on Durga advanced python nodes last pages
Note:
When creating a logger as shown below, it propagates its log messages to root logger, i.e if logger is defined inside a module, which is imported by other file in which logging is defined using basicConfig.All the messages of logger are propagated to logging, because logging.getLogger(__name__),has 1 additional field Propagate, whose default value is set to true.We need to explicitly set it to false to stop propagation
logger = logging.getLogger(__name__)
Comments
Post a Comment