4 ms·
logging's formatter ignores errors. It will complain on console, but no exception will be raised, so the tests would pass. Unless you open test logs and manuall
by theamk 3y ago
logging's formatter ignores errors. It will complain on console, but no exception will be raised, so the tests would pass. Unless you open test logs and manually examine output (and who does this for passing tests?), the test results will show green.
- mixmastamyk 3y agoNot exactly, it does not ignore errors. First, an error doesn’t occur until a format op at/above level happens. Change to log.error() for example and watch the fireworks. Second, true it will continue on, but the error is well logged with a traceback. The thinking, I happen to agree with is that a logging error shouldn’t halt the program. A logging error doesn’t cause an error in the program itself. I could see an argument the other way in specific situations however. I’d probably subclass Logger instead if that is not configurable.
- msm_ 3y ago>Second, true it will continue on, but the error is well logged with a traceback. The thinking, I happen to agree with is that a logging error shouldn’t halt the program. And the parameters are also logged, so you don't really lose anything should this somehow happen in production.