diff --git a/CHANGELOG.md b/CHANGELOG.md index 87a38427..eedc91c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.8 + +* Sensible logging config + ## 0.0.7 * Minor version bump diff --git a/Dockerfile b/Dockerfile index 25138e33..d4510aa0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,6 +58,7 @@ USER root RUN ln -s /home/notebook-user/.local/bin/pip /usr/local/bin/pip USER ${NB_USER} +COPY --chown=${NB_USER}:${NB_USER} logger_config.yaml logger_config.yaml COPY --chown=${NB_USER}:${NB_USER} prepline_${PIPELINE_PACKAGE}/ prepline_${PIPELINE_PACKAGE}/ COPY --chown=${NB_USER}:${NB_USER} exploration-notebooks exploration-notebooks COPY --chown=${NB_USER}:${NB_USER} pipeline-notebooks pipeline-notebooks @@ -65,4 +66,5 @@ COPY --chown=${NB_USER}:${NB_USER} pipeline-notebooks pipeline-notebooks EXPOSE 5000 ENTRYPOINT ["uvicorn", "prepline_general.api.app:app", \ + "--log-config", "logger_config.yaml", \ "--host", "0.0.0.0"] diff --git a/Makefile b/Makefile index ef9b9895..6710086e 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ docker-build: .PHONY: docker-start-api docker-start-api: - docker run -p 8000:8000 --mount type=bind,source=$(realpath .),target=/home/notebook-user/local -t --rm pipeline-family-${PIPELINE_FAMILY}-dev:latest + docker run -p 8000:8000 --mount type=bind,source=$(realpath .),target=/home/notebook-user/local -t --rm pipeline-family-${PIPELINE_FAMILY}-dev:latest --log-config logger_config.yaml --host 0.0.0.0 --port 8000 # Note(austin) we need to install the dev dependencies for this to work # Do we want to build separate dev images? @@ -100,7 +100,7 @@ run-jupyter: ## run-web-app: runs the FastAPI api with hot reloading .PHONY: run-web-app run-web-app: - PYTHONPATH=$(realpath .) uvicorn ${PACKAGE_NAME}.api.app:app --reload + PYTHONPATH=$(realpath .) uvicorn ${PACKAGE_NAME}.api.app:app --reload --log-config logger_config.yaml ################# # Test and Lint # diff --git a/logger_config.yaml b/logger_config.yaml new file mode 100644 index 00000000..4643575b --- /dev/null +++ b/logger_config.yaml @@ -0,0 +1,42 @@ +version: 1 +disable_existing_loggers: False +formatters: + default_format: + "()": uvicorn.logging.DefaultFormatter + format: '%(asctime)s %(name)s %(levelname)s %(message)s' + access: + "()": uvicorn.logging.AccessFormatter + format: '%(asctime)s %(client_addr)s %(request_line)s - %(status_code)s' +handlers: + access_handler: + formatter: access + class: logging.StreamHandler + stream: ext://sys.stderr + standard_handler: + formatter: default_format + class: logging.StreamHandler + stream: ext://sys.stderr +loggers: + uvicorn.error: + level: INFO + handlers: + - standard_handler + propagate: no + # disable logging for uvicorn.error by not having a handler + uvicorn.access: + level: INFO + handlers: + - access_handler + propagate: no + # disable logging for uvicorn.access by not having a handler + unstructured: + level: INFO + handlers: + - standard_handler + propagate: no + unstructured_inference: + level: DEBUG + handlers: + - standard_handler + propagate: no + diff --git a/prepline_general/api/general.py b/prepline_general/api/general.py index b6a4bc2c..b5b6c2e4 100644 --- a/prepline_general/api/general.py +++ b/prepline_general/api/general.py @@ -150,7 +150,7 @@ async def stream_response(self, send: Send) -> None: @router.post("/general/v0/general") -@router.post("/general/v0.0.7/general") +@router.post("/general/v0.0.8/general") def pipeline_1( request: Request, files: Union[List[UploadFile], None] = File(default=None), diff --git a/preprocessing-pipeline-family.yaml b/preprocessing-pipeline-family.yaml index b57c51f0..777a1b0c 100644 --- a/preprocessing-pipeline-family.yaml +++ b/preprocessing-pipeline-family.yaml @@ -1,2 +1,2 @@ name: general -version: 0.0.7 +version: 0.0.8