F5Networks / f5-common-python

Python SDK for configuration and monitoring of F5® BIG-IP® devices via the iControl® REST API.
https://f5-sdk.readthedocs.org
Apache License 2.0
262 stars 134 forks source link

f5.bigip.ManagementRoot adds handler to root logger #1523

Closed SneakyPanda7 closed 5 years ago

SneakyPanda7 commented 5 years ago
[~]> python
Python 3.7.0 (default, Oct  2 2018, 09:20:07)
[Clang 10.0.0 (clang-1000.11.45.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.getLogger().handlers
[]
>>> import f5.bigip
>>> logging.getLogger().handlers
[]
>>> mgmt = f5.bigip.ManagementRoot('REDACTED', 'REDACTED', 'REDACTED')
>>> logging.getLogger().handlers
[<StreamHandler <stderr> (NOTSET)>]
>>>

If I'm writing a framework that uses f5.bigip, all my log messages go to console whether I like it or not. It appears that every method call I make using f5.bigip attaches this handler to the root logger.

jasonrahm commented 5 years ago

Hi @SneakyPanda7, pretty sure this issue belongs to the underlying icontrol rest library, but I'll investigate more closely on Monday.

jasonrahm commented 5 years ago

@SneakyPanda7, try installing my pull request as your f5-icontrol-rest-python package and see if that fixes your issue.

SneakyPanda7 commented 5 years ago

@jasonrahm , yes that fixes it! Thanks. How soon can this get merged to master?

jasonrahm commented 5 years ago

I merged it to the 1.0 release branch, but I won't release until at least Friday. There are a couple other outstanding issues I'd like to address if possible.

jasonrahm commented 5 years ago

closing as merged in the icontrol-rest library