From ad44d116b0eceb1ba3aec8cd26b0aaa6cab9c0de Mon Sep 17 00:00:00 2001 From: Daniel Ecer Date: Mon, 16 Dec 2024 17:02:01 +0000 Subject: [PATCH] Added logging config (#5) --- Dockerfile | 5 +++-- Makefile | 3 ++- config/logging.yaml | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 config/logging.yaml diff --git a/Dockerfile b/Dockerfile index 15abdaf..6afa0fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,8 +18,9 @@ RUN if [ "${install_dev}" = "y" ]; then \ COPY spacy_keyword_extraction_api ./spacy_keyword_extraction_api COPY static ./static -COPY tests ./tests +COPY config ./config +COPY tests ./tests COPY .flake8 .pylintrc ./ -CMD ["python3", "-m", "uvicorn", "spacy_keyword_extraction_api.main:create_app", "--factory", "--host", "0.0.0.0", "--port", "8000"] +CMD ["python3", "-m", "uvicorn", "spacy_keyword_extraction_api.main:create_app", "--factory", "--host", "0.0.0.0", "--port", "8000", "--log-config=config/logging.yaml"] diff --git a/Makefile b/Makefile index 87cab00..cc16f30 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,8 @@ dev-start: --reload \ --factory \ --host 127.0.0.1 \ - --port 8000 + --port 8000 \ + --log-config=config/logging.yaml build: diff --git a/config/logging.yaml b/config/logging.yaml new file mode 100644 index 0000000..7286f53 --- /dev/null +++ b/config/logging.yaml @@ -0,0 +1,22 @@ +version: 1 +disable_existing_loggers: false + +formatters: + standard: + format: "%(asctime)s - %(levelname)s - %(message)s" + +handlers: + console: + class: logging.StreamHandler + formatter: standard + stream: ext://sys.stdout + +loggers: + uvicorn: + error: + propagate: true + +root: + level: INFO + handlers: [console] + propagate: no