[issue17521] fileConfig() disables any previously-used "named" loggers, even when getLogger() is called again.

2013-03-22 Thread Bob Igo

New submission from Bob Igo:

I am aware of the described behavior of fileConfig() when 
disable_existing_loggers is True, but what I am seeing happens whether 
disable_existing_loggers is True or False, and it also affects loggers obtained 
via future, fresh calls to getLogger(name).

Here's an example where disable_existing_loggers is True, but as I said, the 
same happens when it's False:

>>> import logging.config
>>> logging.config.fileConfig('unit_test_logging.conf')
>>> logger = logging.getLogger("foo")
>>> logger.critical("test")
2013-03-21 23:33:04,621fooCRITICALtest
>>> logging.config.fileConfig('unit_test_logging.conf')
>>> logger = logging.getLogger("foo")
>>> logger.critical("test")
>>>

Note that the final logging attempt silently fails. The thing that appears to 
break logging for ever is the second fileConfig() call, and not the following 
getLogger() call.

I can get a fresh logger with a different name and use it. (Continued from the 
above session):

>>> logger = logging.getLogger("bar")
>>> logger.critical("test")
2013-03-21 23:38:35,613barCRITICALtest


This issue does not affect the root logger, when no name is given to 
getLogger():

>>> import logging.config
>>> logging.config.fileConfig('unit_test_logging.conf')
>>> logger = logging.getLogger()
>>> logger.critical("test")
2013-03-22 11:49:29,957rootCRITICALtest
>>> logging.config.fileConfig('unit_test_logging.conf')
>>> logger = logging.getLogger()
>>> logger.critical("test")
2013-03-22 11:49:44,966rootCRITICALtest


However, it _does_ affect the root logger when "root" is given as the name to 
getLogger():

>>> import logging.config
>>> logging.config.fileConfig('unit_test_logging.conf')
>>> logger = logging.getLogger("root")
>>> logger.critical("test")
2013-03-22 12:42:49,742 rootCRITICALtest
>>> logging.config.fileConfig('unit_test_logging.conf')
>>> logger = logging.getLogger("root")
>>> logger.critical("test")
>>> 

I can attach the logging config file if desired, but it looks like the issue is 
unrelated. I will say that I'm relying on the root logger for all my logging, 
but that I use a different name to differentiate how the log is written.

--
components: Library (Lib)
messages: 184982
nosy: Bob.Igo
priority: normal
severity: normal
status: open
title: fileConfig() disables any previously-used "named" loggers, even when 
getLogger() is called again.
type: behavior
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue17521>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17521] fileConfig() disables any previously-used "named" loggers, even when getLogger() is called again.

2013-03-22 Thread Bob Igo

Bob Igo added the comment:

Any configuration I tried still generates the bug, but here's a pared-down 
config file:

[loggers]
keys=root

[handlers]
keys=screen

[formatters]
keys=

[logger_root]
level=DEBUG
handlers=screen

[handler_screen]
level=DEBUG
class=StreamHandler
args=(sys.stdout,)
formatter=

--

___
Python tracker 
<http://bugs.python.org/issue17521>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com