stop unrequired logs

This commit is contained in:
2025-08-30 02:25:01 +09:00
parent 9af1e03523
commit cf0adb34f9
2 changed files with 49 additions and 2 deletions

View File

@ -14,6 +14,17 @@ from pathlib import Path
import environ import environ
import os import os
import dj_database_url import dj_database_url
import warnings
import logging
# Suppress matplotlib and other library debug logs
os.environ['MPLBACKEND'] = 'Agg'
warnings.filterwarnings('ignore')
# Disable specific library debug logging
logging.getLogger('matplotlib').setLevel(logging.WARNING)
logging.getLogger('matplotlib.font_manager').setLevel(logging.WARNING)
logging.getLogger('PIL').setLevel(logging.WARNING)
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
@ -275,14 +286,14 @@ LOGGING = {
# 'formatter': 'verbose', # 'formatter': 'verbose',
#}, #},
'console': { 'console': {
'level': 'DEBUG', 'level': 'INFO',
'class': 'logging.StreamHandler', 'class': 'logging.StreamHandler',
'formatter': 'verbose', 'formatter': 'verbose',
}, },
}, },
'root': { 'root': {
'handlers': ['console'], 'handlers': ['console'],
'level': 'DEBUG', 'level': 'INFO',
}, },
'loggers': { 'loggers': {
'django': { 'django': {
@ -300,6 +311,37 @@ LOGGING = {
'level': 'DEBUG', 'level': 'DEBUG',
'propagate': True, 'propagate': True,
}, },
# Suppress verbose debug logs from various libraries
'matplotlib': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': False,
},
'geos': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': False,
},
'env': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': False,
},
'pyplot': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': False,
},
'font_manager': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': False,
},
'environ': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': False,
},
}, },
} }

View File

@ -41,6 +41,11 @@ services:
- media_volume:/app/media - media_volume:/app/media
env_file: env_file:
- .env - .env
environment:
- MPLBACKEND=Agg
- MATPLOTLIB_BACKEND=Agg
- PYTHONWARNINGS=ignore
- GDAL_DISABLE_READDIR_ON_OPEN=YES
healthcheck: healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8000')\" || exit 1"] test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8000')\" || exit 1"]
interval: 30s interval: 30s