Skip to content

Commit fbb7c7e

Browse files
authored
Merge pull request #100 from dbmi-pitt/Derek-Furst/debug-config
added a configuration change allowing debug_mode to set the logging l…
2 parents dc012b3 + 3e74c89 commit fbb7c7e

File tree

5 files changed

+4
-10
lines changed

5 files changed

+4
-10
lines changed

src/app.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
# Log rotation is handled via logrotate on the host system with a configuration file
2626
# Do NOT handle log file and rotation via the Python logging to avoid issues with multi-worker processes
2727

28-
logging.basicConfig(format='[%(asctime)s] %(levelname)s in %(module)s:%(lineno)d: %(message)s', level=logging.DEBUG,
29-
datefmt='%Y-%m-%d %H:%M:%S')
3028

3129
class SearchAPI:
3230
def __init__(self, config, translator_module, blueprint=None, ubkg_instance=None, progress_interface=None):
@@ -64,7 +62,10 @@ def __init__(self, config, translator_module, blueprint=None, ubkg_instance=None
6462
# If a Flask Blueprint is passed in from a service using this class, load that Blueprint.
6563
if blueprint is not None:
6664
self.app.register_blueprint(blueprint)
67-
65+
if self.DEBUG_MODE:
66+
logging.basicConfig(format='[%(asctime)s] %(levelname)s in %(module)s: %(message)s', level=logging.DEBUG, datefmt='%Y-%m-%d %H:%M:%S')
67+
else:
68+
logging.basicConfig(format='[%(asctime)s] %(levelname)s in %(module)s: %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S')
6869
@self.app.errorhandler(400)
6970
def __http_bad_request(e):
7071
return self.http_bad_request(e)

src/indexer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
from libs.es_writer import ESWriter
55

6-
logging.basicConfig(format='[%(asctime)s] %(levelname)s in %(module)s: %(message)s', level=logging.INFO,
7-
datefmt='%Y-%m-%d %H:%M:%S')
86
logger = logging.getLogger(__name__)
97

108
class Indexer:

src/libs/es_writer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# All the API logging is forwarded to the uWSGI server and gets written into the log file `uwsgo-entity-api.log`
99
# Log rotation is handled via logrotate on the host system with a configuration file
1010
# Do NOT handle log file and rotation via the Python logging to avoid issues with multi-worker processes
11-
logging.basicConfig(format='[%(asctime)s] %(levelname)s in %(module)s:%(lineno)d: %(message)s', level=logging.DEBUG, datefmt='%Y-%m-%d %H:%M:%S')
1211
logger = logging.getLogger(__name__)
1312

1413
class ESWriter:

src/opensearch_helper_functions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from urllib.parse import urlparse
99
from hubmap_commons.S3_worker import S3Worker
1010

11-
logging.basicConfig(format='[%(asctime)s] %(levelname)s in %(module)s:%(lineno)d: %(message)s', level=logging.DEBUG,
12-
datefmt='%Y-%m-%d %H:%M:%S')
1311
logger = logging.getLogger(__name__)
1412

1513
app = Flask(__name__, instance_path=os.path.join(os.path.abspath(os.path.dirname(__file__)), 'instance'),

src/translator/tranlation_helper_functions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import yaml
66
from flask import jsonify
77

8-
logging.basicConfig(format='[%(asctime)s] %(levelname)s in %(module)s: %(message)s', level=logging.DEBUG,
9-
datefmt='%Y-%m-%d %H:%M:%S')
108
logger = logging.getLogger(__name__)
119

1210

0 commit comments

Comments
 (0)