[Haskell-cafe] Re: hslogger bugs or features?

Marc Weber marco-oweber at gmx.de
Tue Feb 3 04:19:26 EST 2009


Hi John,

thank you for your feedback:
I've taken the time to rewrite the example (issue1) using the python
logging system. I came up with:

  import logging
  logging.basicConfig(level=logging.DEBUG,
                      format='%(asctime)s %(levelname)s %(message)s',
                      filename='/tmp/myapp.log',
                      filemode='w')

  logging.getLogger('').setLevel(logging.DEBUG)

  loggerSub = logging.getLogger('A.B.C')

  loggerSub.critical('CRITICAL test, should be shown and should create the sublogger')

  logging.getLogger('').setLevel(logging.WARNING)
  loggerSub.debug('WARNING test, should not be shown cause we have changed to WARNING')


which only logs the first line but not the second one
  2009-02-03 11:14:52,058 CRITICAL CRITICAL test, should be shown and should create the sublogger


hackage hslogger does clone the priority setting for A.B.C (in getLogger).
The cloned value is no longer affected by when changing the top level logging
priority.
So this example makes hackage hslogger log both lines.

So I consider this a beeing a (small) bug.

Sincerly
Marc Weber


More information about the Haskell-Cafe mailing list