The problem for me with logging is that it's slow for production code:
Python 2.7.15 Linux (logging is 60x slower):
[root@hbtest ~]# py -m timeit -s 'import logging' "logging.info('something happened')"
1000000 loops, best of 3: 1.31 usec per loop
[root@hbtest ~]# py -m timeit -s 'import sys; debug = False' "if debug: print >>sys.stderr, 'something happened'"
10000000 loops, best of 3: 0.0216 usec per loop
Python 2.7.15 OSX (logging is 71x slower):
$ py -m timeit -s 'import logging' "logging.info('something happened')"
1000000 loops, best of 3: 0.925 usec per loop
[jim@mbp hbrel]$ py -m timeit -s 'import sys; debug = False' "if debug: print >>sys.stderr, 'something happened'"
100000000 loops, best of 3: 0.013 usec per loop
Python 3.6.8 Linux (logging is 99x slower):
[root@hbtest ~]# python3 -m timeit -s 'import logging' "logging.info('something happened')"
1000000 loops, best of 3: 1.62 usec per loop
[root@hbtest ~]# python3 -m timeit -s 'import sys; debug = False' "if debug: print >>sys.stderr, 'something happened'"
100000000 loops, best of 3: 0.0163 usec per loop
And, as usual, Python 3 is 25% slower than Python 2 for the logging case (but 2x faster for the noop if debug case). I hope the recent efforts to increase Python 3 performance are successful.
Python 2.7.15 Linux (logging is 60x slower):
Python 2.7.15 OSX (logging is 71x slower): Python 3.6.8 Linux (logging is 99x slower): And, as usual, Python 3 is 25% slower than Python 2 for the logging case (but 2x faster for the noop if debug case). I hope the recent efforts to increase Python 3 performance are successful.