I have a script using several imported submodules of mine, each of them using the module logging. In 1 of them i wrote a bad code line, but i can figure out where it is. Indeed, the synthax for a typical logging output with an argument var is:
logging.info("my var=%s", var)
If the number of arguments does not correspond to the number of %s in the string, there is an error message from logging as follows :
Traceback (most recent call last):
File "/usr/lib/python2.6/logging/__init__.py", line 776, in emit
msg = self.format(record)
File "/usr/lib/python2.6/logging/__init__.py", line 654, in format
return fmt.format(record)
File "/usr/lib/python2.6/logging/__init__.py", line 436, in format
record.message = record.getMessage()
File "/usr/lib/python2.6/logging/__init__.py", line 306, in getMessage
msg = msg % self.args
ValueError: incomplete format
The problem is that this error message is completely generic: it does not show the name of the module where the probleme appear, nor the code line, nor the arguments... which makes impossible for me to find out where I wrote a bad call to logging.info()