Unidata / siphon

Siphon - A collection of Python utilities for retrieving atmospheric and oceanic data from remote sources, focusing on being able to retrieve data from Unidata data technologies, such as the THREDDS data server.

Home Page:https://unidata.github.io/siphon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Importing siphon.catalog messes up logging

hcholm opened this issue · comments

catalog.py configures logging on import, overriding any logging config set up by the client.

This line should be removed:

logging.basicConfig(level=logging.ERROR) 

I haven't looked for similar cases in other parts of the code.

I see that logging.basicConfig is being called in a lot of imports. A workaround example:

import logging
from siphon.catalog import Dataset, TDSCatalog
from siphon.ncss import NCSS
import importlib
importlib.reload(logging)

Hi, I ran into this issue as well recently.

import logging
from siphon.catalog import TDSCatalog

FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
logging.basicConfig(format=FORMAT)
logger = logging.getLogger(__name__)
logger.warning("Test This")

Will not work when TDSCatalog is imported.