diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7c05ad6ed9246666d9d9260d5a89bf58d8ace9b0..0f95ec9721667e856a3b79a1bdd5444003293066 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -9,10 +9,13 @@ if [ "${WEBSERVICE}" = "false" ]; then # run arguments as command, or bash prompt if no arguments exec "${@:-/bin/bash}" else + export LOG_BASIC_CONFIG="${LOG_BASIC_CONFIG:-true}" + export LOG_LEVEL="${LOG_LEVEL:-INFO}" # run gunicorn server for web service exec gunicorn \ --access-logfile - \ --bind 0.0.0.0:8000 \ + --log-level "${LOG_LEVEL}" \ --threads 2 \ --workers 2 \ --worker-class uvicorn.workers.UvicornWorker \ diff --git a/geomagio/api/app.py b/geomagio/api/app.py index 47fb64a47dc6bcd75596d148487f1c5afa113363..618fe8edd91d924a8a9d864cc569fba8a5065cf9 100644 --- a/geomagio/api/app.py +++ b/geomagio/api/app.py @@ -15,10 +15,10 @@ from starlette.responses import RedirectResponse from . import secure, ws from .db import database -# configure logging -DEBUG = os.getenv('DEBUG', 'false') -LOG_LEVEL = logging.DEBUG if DEBUG == "true" else logging.INFO -logging.basicConfig(level=LOG_LEVEL) +LOG_BASIC_CONFIG = os.getenv("LOG_BASIC_CONFIG", "false") +LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO") +if LOG_BASIC_CONFIG == "true": + logging.basicConfig(level=LOG_LEVEL) app = FastAPI() app.mount("/ws/secure", secure.app)