Closed jordanjms17 closed 3 years ago
It's because dnacentersdk
is configured to create a StreamHandler
as well.
If we remove this line (L55 in __init__.py
), there would only be one logging stream (as you expect in your sample code).
pip install dnacentersdk
git clone https://github.com/cisco-en-programmability/dnacentersdk.git
cd dnacentersdk
sed -i 's/logging.basicConfig()/#logging.basicConfig()/' dnacentersdk/__init__.py
Then run your sample script.
python issue_17.py
2020-10-14 20:05:35,525 - simple_example - DEBUG - debug message
I'll let the maintainers comment on how they want to proceed ☺️
Let me review it this weekend and get back to you. We are working on upgrading the SDK to 2.1.2 and we should be able to fix this when we release that version.
We are working on updating the SDK to include support for DNAC 2.1.2. We'll improve the logging for that release, which should be ready in two to three weeks.
This one appears to be fixed in v2.0.2 of the SDK. Closing the issue.
Thanks for the help @jbogarin and @robertcsapo
@jordanjms17 thanks, sorry I didn't let you know but we are working on including some extra stuff around the DNA Center SDK for the end of November and haven't had the time to check the issues and close those that are fixed.
Thanks for letting us know that it was solved.
We did update the docs https://dnacentersdk.readthedocs.io/en/latest/api/quickstart.html#configuring-logging-for-dnacentersdk so maybe that also helps.
I have boiled this down to a basic issue introduced when importing dnacentersdk, so I'm using the basic logging example from https://docs.python.org/3.7/howto/logging.html#configuring-logging to demonstrate the issue. When DNACenterAPI is imported, logging messages are sent to stdout twice (once following the configured formatter and once unformatted)
Output with
from dnacentersdk import DNACenterAPI
Output without
from dnacentersdk import DNACenterAPI
2020-10-09 15:22:38,215 - simple_example - DEBUG - debug message
Any thoughts on how to stop the extra output would be appreciated.
Thanks!