Bug 1060206 - python-nitrate sets log level for root logger to WARNING
Summary: python-nitrate sets log level for root logger to WARNING
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-nitrate
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Šplíchal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-31 13:10 UTC by Katarzyna Jachim
Modified: 2016-06-01 01:45 UTC (History)
3 users (show)

Fixed In Version: python-nitrate-1.0-0.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-05-18 22:53:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
proposed solution - please test it (463 bytes, patch)
2014-01-31 13:10 UTC, Katarzyna Jachim
no flags Details | Diff

Description Katarzyna Jachim 2014-01-31 13:10:39 UTC
Created attachment 857841 [details]
proposed solution - please test it

Description of problem:

From nitrate.py:
from api import *

From api.py:
_log_level = log.WARN

def set_log_level(level=None):
...
    log.getLogger().setLevel(_log_level)

set_log_level()

It means that after you import nitrate in your code, you will have log level of the root logger set to WARNING from the moment of the import, which may affect all your logging in the system (especially if you create all loggers with default NOTSET level and let them delegate messages to parents).


Version-Release number of selected component (if applicable):


How reproducible: 


Steps to Reproduce:

>>> import logging
>>> logging.basicConfig(level=logging.INFO)
>>> logger = logging.getLogger('test')
>>> logging.getLogger().getEffectiveLevel()
20
>>> logger.getEffectiveLevel()
20
>>> import nitrate
>>> logging.getLogger().getEffectiveLevel()
30
>>> logger.getEffectiveLevel()
30


Actual results: importing nitrate changes the log level of the root logger


Expected results:
* importing nitrate should not change the log level of the root logger
* using nitrate should not change the level as well

Additional info:

Comment 2 Petr Šplíchal 2014-03-03 16:53:09 UTC
Thanks for the bug. This should now be fixed in the devel branch:
https://github.com/psss/python-nitrate/commit/1735dbf

Comment 3 Fedora Update System 2014-04-11 15:25:34 UTC
python-nitrate-1.0-0.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/python-nitrate-1.0-0.fc20

Comment 4 Fedora Update System 2014-04-15 15:36:39 UTC
Package python-nitrate-1.0-0.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-nitrate-1.0-0.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-5095/python-nitrate-1.0-0.fc20
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2014-05-18 22:53:51 UTC
python-nitrate-1.0-0.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.