Bug 1123524 - Don't add stream handler to root logger in library
Summary: Don't add stream handler to root logger in library
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: packagedb-cli
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Pierre-YvesChibon
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1114381 1120690 (view as bug list)
Depends On:
Blocks: 1114381
TreeView+ depends on / blocked
 
Reported: 2014-07-25 23:23 UTC by Pavol Babinčák
Modified: 2014-09-26 16:12 UTC (History)
4 users (show)

Fixed In Version: packagedb-cli-2.5-1.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-26 07:02:46 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch which fixes the bug (1.37 KB, patch)
2014-07-25 23:25 UTC, Pavol Babinčák
no flags Details | Diff

Description Pavol Babinčák 2014-07-25 23:23:16 UTC
Description of problem:
Python module pkgdb2client configures logging with logging.basicConfig()[1]. Libraries which import this module need to unnecessary fix logging configuration. Otherwise any log messages are written to stderr.

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

How reproducible:
Always

Steps to Reproduce:
1. $ python
>>> import logging
>>> import pkgdb2client
>>> import sys
>>> logger = logging.getLogger('myLogger')
>>> logger.setLevel(logging.DEBUG)
>>> ch = logging.StreamHandler(sys.stdout)
>>> ch.setLevel(logging.DEBUG)
>>> logger.addHandler(ch)
>>> logger.debug('test message')

Actual results:
On the stdout & stderr following messages are printed:
test message
DEBUG:myLogger:test message

Expected results:
Only message to stdout should be printed:
test message

Additional info:
Logging documentation describes[2] how considerate python libraries should be configured towards other libraries.

[1] https://docs.python.org/3.1/library/logging.html#logging.basicConfig
[2] https://docs.python.org/3.1/library/logging.html#library-config

Comment 1 Pavol Babinčák 2014-07-25 23:25:25 UTC
Created attachment 921094 [details]
Patch which fixes the bug

Patch with fix attached.

Comment 2 Pierre-YvesChibon 2014-07-26 07:02:46 UTC
Thanks for the catch and thanks for the patch :)

Comment 3 Jens Petersen 2014-07-30 02:23:07 UTC
*** Bug 1114381 has been marked as a duplicate of this bug. ***

Comment 4 Fedora Update System 2014-07-31 05:42:35 UTC
packagedb-cli-2.5-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/packagedb-cli-2.5-1.fc19

Comment 5 Fedora Update System 2014-07-31 05:42:42 UTC
packagedb-cli-2.5-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/packagedb-cli-2.5-1.el6

Comment 6 Fedora Update System 2014-07-31 05:42:47 UTC
packagedb-cli-2.5-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/packagedb-cli-2.5-1.fc20

Comment 7 Fedora Update System 2014-08-15 02:41:23 UTC
packagedb-cli-2.5-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2014-08-18 18:57:50 UTC
packagedb-cli-2.5-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2014-08-19 07:06:12 UTC
packagedb-cli-2.5-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Pavol Babinčák 2014-09-26 16:12:05 UTC
*** Bug 1120690 has been marked as a duplicate of this bug. ***


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