Netflix-Skunkworks/policyuniverse

Unnecessary call to logging.basicConfig() in __init__.py

Closed this issue · 1 comments

I'm using ScoutSuite, which in turn uses the policyuniverse module. I've noticed an additional logging handler is getting initialized, and I think I've traced it back to a call to logging.basicConfig() that's done in the policyuniverse/__init__.py file:

https://github.com/Netflix-Skunkworks/policyuniverse/blob/master/policyuniverse/__init__.py#L12-L15

It's not clear what that logging initialization is for; can lines 12-15 be removed?

Test case:

#!/usr/bin/env python3

import logging

from policyuniverse.policy import Policy

log = logging.getLogger()
log.setLevel(logging.DEBUG)

logging_handler = logging.StreamHandler()
logging_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
log.addHandler(logging_handler)

log.debug('Starting program!')

results in the following output:

$ ./test1.py 
DEBUG:root:Starting program!
2019-09-27 16:44:17,761 [DEBUG] Starting program!

Adding @mikegrima - That dude always helps me with these kinds of things.