diff --git a/scripts/geodata/geonames/geonames_sqlite.py b/scripts/geodata/geonames/geonames_sqlite.py index 23be2100..17c56dbf 100644 --- a/scripts/geodata/geonames/geonames_sqlite.py +++ b/scripts/geodata/geonames/geonames_sqlite.py @@ -24,7 +24,7 @@ from geodata.log import * from itertools import islice, chain -log_to_stdout() +log_to_file(sys.stderr) logger = logging.getLogger('geonames.sqlite') GEONAMES_DB_NAME = 'geonames.db' diff --git a/scripts/geodata/log.py b/scripts/geodata/log.py index 43c702a5..f6636785 100644 --- a/scripts/geodata/log.py +++ b/scripts/geodata/log.py @@ -2,8 +2,8 @@ import logging import sys -def log_to_stdout(level=logging.INFO): - handler = logging.StreamHandler(sys.stdout) +def log_to_file(f, level=logging.INFO): + handler = logging.StreamHandler(f) formatter = logging.Formatter('%(asctime)s %(levelname)s [%(name)s]: %(message)s') handler.setFormatter(formatter) logging.root.addHandler(handler)