shouldn't the import logging be before the if?