Bug 1060206

Summary: python-nitrate sets log level for root logger to WARNING
Product: [Fedora] Fedora Reporter: Katarzyna Jachim <kjachim>
Component: python-nitrateAssignee: Petr Šplíchal <psplicha>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ncredi, ohudlick, psplicha
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-nitrate-1.0-0.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-18 22:53:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed solution - please test it none

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.