We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
running the code below, produces a warning from watchtower
WatchtowerWarning: Received message after logging system shutdown warnings.warn("Received message after logging system shutdown", WatchtowerWarning)
and no logs are forwarded to cloudwatch. after the first access to the / path.
using curl: curl -vs http://localhost:8080/ 2>&1
from fastapi import FastAPI, Response from fastapi.responses import HTMLResponse import uvicorn import logging import watchtower app = FastAPI() logging.basicConfig(level=logging.INFO) logger = logging.getLogger("logger_name") # logger.propagate = False logger.setLevel(logging.INFO) logger.addHandler(watchtower.CloudWatchLogHandler( log_group_name="log_group_name" )) class EndpointFilter(logging.Filter): def filter(self, record: logging.LogRecord) -> bool: return record.getMessage().find("/health") == -1 logging.getLogger("uvicorn.access").addFilter(EndpointFilter()) @app.get("/", status_code=200) async def hello(): logger.info("hello called") return Response(content="world", media_type="text") if __name__ == "__main__": port = 8080 logger.info(f"Booting up, listening port is set to {port}") uvicorn.run(app, host="0.0.0.0", port=port, server_header=False, date_header=False) logger.info("Server done")
Please advice.
The text was updated successfully, but these errors were encountered:
What have you tried to solve the problem? Does the same issue occur without the filter?
Sorry, something went wrong.
No branches or pull requests
running the code below, produces a warning from watchtower
WatchtowerWarning: Received message after logging system shutdown
warnings.warn("Received message after logging system shutdown", WatchtowerWarning)
and no logs are forwarded to cloudwatch. after the first access to the / path.
using curl: curl -vs http://localhost:8080/ 2>&1
Please advice.
The text was updated successfully, but these errors were encountered: