Fix lightrag logger initailization problem, fix gunicorn acccess log missing

This commit is contained in:
yangdx
2025-02-28 16:07:33 +08:00
parent 157ec862ae
commit 81f6f6e343
2 changed files with 7 additions and 14 deletions

View File

@@ -70,11 +70,6 @@ logconfig_dict = {
'level': 'INFO',
'propagate': False
},
'uvicorn': {
'handlers': ['console', 'file'],
'level': 'INFO',
'propagate': False
},
'gunicorn': {
'handlers': ['console', 'file'],
'level': 'INFO',
@@ -84,6 +79,11 @@ logconfig_dict = {
'handlers': ['console', 'file'],
'level': 'INFO',
'propagate': False
},
'gunicorn.access': {
'handlers': ['console', 'file'],
'level': 'INFO',
'propagate': False
}
}
}

View File

@@ -39,13 +39,10 @@ from .routers.query_routes import create_query_routes
from .routers.graph_routes import create_graph_routes
from .routers.ollama_api import OllamaAPI
from lightrag.utils import logger as utils_logger
from lightrag.utils import logger, set_verbose_debug
# Load environment variables
try:
load_dotenv(override=True)
except Exception as e:
utils_logger.warning(f"Failed to load .env file: {e}")
load_dotenv(override=True)
# Initialize config parser
config = configparser.ConfigParser()
@@ -88,10 +85,6 @@ class LightragPathFilter(logging.Filter):
def create_app(args):
# Initialize verbose debug setting
# Can not use the logger at the top of this module when workers > 1
from lightrag.utils import set_verbose_debug, logger
# Setup logging
logger.setLevel(getattr(logging, args.log_level))
set_verbose_debug(args.verbose)