Bug 1334916 - YUM plugins reconfigure root logger
Summary: YUM plugins reconfigure root logger
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Chris Snyder
QA Contact: John Sefler
Depends On:
Blocks: 1335548 1338982
TreeView+ depends on / blocked
Reported: 2016-05-10 19:19 UTC by Jeff Ortel
Modified: 2017-02-23 09:31 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1335548 1338982 (view as bug list)
Last Closed: 2016-11-03 20:28:51 UTC
Target Upstream Version:

Attachments (Terms of Use)
Reproducer (464 bytes, text/plain)
2016-06-17 16:02 UTC, Jeff Ortel
no flags Details

System ID Priority Status Summary Last Updated
Github candlepin subscription-manager pull 1461 None None None 2016-08-02 15:56:50 UTC
Red Hat Product Errata RHSA-2016:2592 normal SHIPPED_LIVE Moderate: subscription-manager security, bug fix, and enhancement update 2016-11-03 12:10:42 UTC

Description Jeff Ortel 2016-05-10 19:19:31 UTC
Description of problem:

The RHSM YUM plugins (product-id and subscription-manager) reconfigure the python root logger.  This causes everything within any process using YUM to be logged to /var/log/rhsm/rhsm.log instead how/where intended.  This is likely an unintended side effect of switching to file-based logging configuration.

See commit: https://github.com/candlepin/subscription-manager/commit/66aafd77dc629b921379f0e121421c1c21c0b787

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


How reproducible:


Steps to Reproduce:
1. Using any python script:
2. Configure logging.
3. Using YumBase, perform any YUM operation.
4. Log something.
5. Note it get's logged in /var/log/rhsm/rhsm.conf instead of where intended.

Actual results:

Logged in /var/log/rhsm/rhsm.conf instead of where intended.

Expected results:

Messages logged based on logging setup before using YUM.

Additional info:

Comment 2 Jeff Ortel 2016-06-17 16:02:40 UTC
Created attachment 1169171 [details]

Must have subscription-manager installed.

Comment 3 John Sefler 2016-08-08 17:55:20 UTC
Using attachment 1169171 [details] to demonstrate this bugzilla for QE purposes...

On a RHEL7 system that has been registered and subscribed to access rhel-7-server-rpms ...

[root@jsefler-rhel7 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server:
subscription management rules: 5.15.1
subscription-manager: 1.17.9-1.el7
python-rhsm: 1.17.5-1.el7

[root@jsefler-rhel7 ~]# subscription-manager list --installed
    Installed Product Status
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        7.3 Beta
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         05/28/2016
Ends:           05/27/2017

[root@jsefler-rhel7 ~]# rpm -q zsh
package zsh is not installed

[root@jsefler-rhel7 ~]# wget --no-verbose --no-check-certificate --output-document=/tmp/bug1334916reproducer.py https://bugzilla.redhat.com/attachment.cgi?id=1169171
2016-08-08 13:34:53 URL:https://bugzilla.redhat.com/attachment.cgi?id=1169171 [464/464] -> "/tmp/bug1334916reproducer.py" [1]

[root@jsefler-rhel7 ~]# python /tmp/bug1334916reproducer.py
handlers (before) [<logging.StreamHandler object at 0x7fd5ab7d31d0>]
Loaded plugins: langpacks, product-id, rhnplugin
This system is not registered with RHN Classic or Red Hat Satellite.
You can use rhn_register to register.
Red Hat Satellite or RHN Classic support will be disabled.
Running Transaction Check
Installing: zsh-5.0.2-14.el7_2.2.x86_64 6008068/6008068 [1/1]
Verify: 1/1: zsh.x86_64 0:5.0.2-14.el7_2.2 - u
handlers (after) [<subscription_manager.logutil.SubmanDebugHandler object at 0x47f0990>]

[root@jsefler-rhel7 ~]# rpm -q zsh

BANG! You'll notice in the output above that the handlers before and after have changed.  That should not happen.  There should NOT have been a hijacking of the loggers.
handlers (before) [<logging.StreamHandler object at 0x7fd5ab7d31d0>]
handlers (after) [<subscription_manager.logutil.SubmanDebugHandler object at 0x47f0990>]
Moreover, as a consequence of the hijacking, you'll see in the tail -f /var/log/rhsm/rhsm.log the unintended logging of the reproducer script bug1334916reproducer.py...

[root@jsefler-rhel7 ~]# tail -f /var/log/rhsm/rhsm.log
2016-08-08 13:35:55,490 [DEBUG] bug1334916reproducer.py:2926 @plugins.py:569 - loaded plugin modules: [<module 'container_content' from '/usr/share/rhsm-plugins/container_content.pyc'>, <module 'ostree_content' from '/usr/share/rhsm-plugins/ostree_content.pyc'>]
2016-08-08 13:35:55,490 [DEBUG] bug1334916reproducer.py:2926 @plugins.py:570 - loaded plugins: {'container_content.ContainerContentPlugin': <container_content.ContainerContentPlugin object at 0x47d3e10>, 'ostree_content.OstreeContentPlugin': <ostree_content.OstreeContentPlugin object at 0x47d73d0>}
2016-08-08 13:35:56,412 [DEBUG] bug1334916reproducer.py:2926 @productid.py:643 - Checking for product certs to remove. Active include: set(['rhel-7-server-rpms'])
2016-08-08 13:35:56,415 [DEBUG] bug1334916reproducer.py:2926 @productid.py:689 - rhel-7-server-rpms is an active repo. Not deleting product cert 69
2016-08-08 13:35:56,415 [DEBUG] bug1334916reproducer.py:2926 @productid.py:421 - Checking for product id certs to install or update.
2016-08-08 13:35:56,415 [DEBUG] bug1334916reproducer.py:2926 @productid.py:426 - active set(['rhel-7-server-rpms'])
2016-08-08 13:35:56,415 [DEBUG] bug1334916reproducer.py:2926 @productid.py:427 - enabled [(<rhsm.certificate2.ProductCertificate object at 0x4b2c3d0>, 'rhel-7-server-rpms'), (<rhsm.certificate2.ProductCertificate object at 0x47cd290>, 'rhel-sap-for-rhel-7-server-rpms')]
2016-08-08 13:35:56,416 [DEBUG] bug1334916reproducer.py:2926 @productid.py:443 - product cert: 69 repo: rhel-7-server-rpms
2016-08-08 13:35:56,416 [DEBUG] bug1334916reproducer.py:2926 @productid.py:505 - Latest version of product cert for Red Hat Enterprise Linux Server 7.1 is already installed, not updating
2016-08-08 13:35:56,416 [DEBUG] bug1334916reproducer.py:2926 @productid.py:443 - product cert: 146 repo: rhel-sap-for-rhel-7-server-rpms
2016-08-08 13:35:56,416 [DEBUG] bug1334916reproducer.py:2926 @productid.py:561 - about to run post_product_id_install
2016-08-08 13:35:56,416 [DEBUG] bug1334916reproducer.py:2926 @productid.py:572 - about to run post_product_id_update

Comment 7 errata-xmlrpc 2016-11-03 20:28:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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