diff --git a/README.md b/README.md index 3e980cf..349e915 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Optional environment variables: * `GATEWAY_EXTRA_SCRIPTS` - JSON array of script paths, will be embedded into each page and forwarded with `--scripts` to cellxgene server * `GATEWAY_ENABLE_ANNOTATIONS` - Set to `true` or to `1` to enable cellxgene annotations. * `GATEWAY_ENABLE_BACKED_MODE` - Set to `true` or to `1` to load AnnData in file-backed mode. This saves memory and speeds up launch time but may reduce overall performance. +* `GATEWAY_LOG_LEVEL` - default is `INFO`. set to `DEBUG` to increase logging and to `WARNING` to decrease logging. * `S3_ENABLE_LISTINGS_CACHE` - Set to `true` or to `1` to cache listings of S3 folders for performance. If the cache becomes stale, set `filecrawl.html?refresh=true` query parameter to refresh the cache. If any of the following optional variables are set, [ProxyFix](https://werkzeug.palletsprojects.com/en/1.0.x/middleware/proxy_fix/) will be used. diff --git a/cellxgene_gateway/env.py b/cellxgene_gateway/env.py index 5f98160..26288c4 100644 --- a/cellxgene_gateway/env.py +++ b/cellxgene_gateway/env.py @@ -9,7 +9,6 @@ import logging import os -import socket cellxgene_location = os.environ.get("CELLXGENE_LOCATION") cellxgene_data = os.environ.get("CELLXGENE_DATA", "") @@ -33,6 +32,7 @@ enable_backed_mode = os.environ.get("GATEWAY_ENABLE_BACKED_MODE", "").lower() in "true", "1", ] +log_level = logging.getLevelName(os.environ.get("GATEWAY_LOG_LEVEL", "INFO")) env_vars = { "CELLXGENE_LOCATION": cellxgene_location, @@ -53,6 +53,7 @@ optional_env_vars = { "GATEWAY_TTL": ttl, "GATEWAY_ENABLE_ANNOTATIONS": enable_annotations, "GATEWAY_ENABLE_BACKED_MODE": enable_backed_mode, + "GATEWAY_LOG_LEVEL": log_level, "CELLXGENE_ARGS": cellxgene_args, "CELLXGENE_DATA": cellxgene_data, "PROXY_FIX_FOR": proxy_fix_for, diff --git a/cellxgene_gateway/gateway.py b/cellxgene_gateway/gateway.py index 11302ec..c930974 100644 --- a/cellxgene_gateway/gateway.py +++ b/cellxgene_gateway/gateway.py @@ -299,7 +299,7 @@ def launch(): def main(): logging.basicConfig( - level=logging.INFO, + level=env.log_level, format="%(asctime)s:%(name)s:%(levelname)s:%(message)s", ) cellxgene_data = os.environ.get("CELLXGENE_DATA", None)