LiamKhoaLe commited on
Commit
15ed85c
·
1 Parent(s): 0123a67

Suppress logs

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. app.py +11 -1
Dockerfile CHANGED
@@ -32,4 +32,4 @@ RUN chown -R user:user /app/model_cache
32
  EXPOSE 7860
33
 
34
  # Run the application
35
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--log-level", "debug"]
 
32
  EXPOSE 7860
33
 
34
  # Run the application
35
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
app.py CHANGED
@@ -11,8 +11,18 @@ from sentence_transformers import SentenceTransformer
11
 
12
  # ✅ Enable Logging for Debugging
13
  import logging
14
- logging.basicConfig(level=logging.DEBUG)
 
 
 
 
 
 
 
 
 
15
  logger = logging.getLogger("medical-chatbot")
 
16
  # Debug Start
17
  logger.info("🚀 Starting Medical Chatbot API...")
18
  print("🚀 Starting Medical Chatbot API...")
 
11
 
12
  # ✅ Enable Logging for Debugging
13
  import logging
14
+ # —————— Silence Noisy Loggers ——————
15
+ for name in [
16
+ "uvicorn.error", "uvicorn.access",
17
+ "fastapi", "starlette",
18
+ "pymongo", "gridfs",
19
+ "sentence_transformers", "faiss",
20
+ "google", "google.auth",
21
+ ]:
22
+ logging.getLogger(name).setLevel(logging.WARNING)
23
+ logging.basicConfig(level=logging.DEBUG, format="%(asctime)s — %(name)s — %(levelname)s — %(message)s", force=True)
24
  logger = logging.getLogger("medical-chatbot")
25
+ logger.setLevel(logging.DEBUG)
26
  # Debug Start
27
  logger.info("🚀 Starting Medical Chatbot API...")
28
  print("🚀 Starting Medical Chatbot API...")