diff --git a/backend/onyx/background/celery/apps/app_base.py b/backend/onyx/background/celery/apps/app_base.py index 7827fd054b3..07286745337 100644 --- a/backend/onyx/background/celery/apps/app_base.py +++ b/backend/onyx/background/celery/apps/app_base.py @@ -414,11 +414,21 @@ def on_setup_logging( task_logger.setLevel(loglevel) task_logger.propagate = False - # Hide celery task received and succeeded/failed messages + # hide celery task received spam + # e.g. "Task check_for_pruning[a1e96171-0ba8-4e00-887b-9fbf7442eab3] received" strategy.logger.setLevel(logging.WARNING) + + # uncomment this to hide celery task succeeded/failed spam + # e.g. "Task check_for_pruning[a1e96171-0ba8-4e00-887b-9fbf7442eab3] succeeded in 0.03137450001668185s: None" trace.logger.setLevel(logging.WARNING) +def set_task_finished_log_level(logLevel: int) -> None: + """call this to override the setLevel in on_setup_logging. We are interested + in the task timings in the cloud but it can be spammy for self hosted.""" + trace.logger.setLevel(logLevel) + + class TenantContextFilter(logging.Filter): """Logging filter to inject tenant ID into the logger's name.""" diff --git a/backend/onyx/background/celery/apps/primary.py b/backend/onyx/background/celery/apps/primary.py index 5a3b61552f9..267d51ade7c 100644 --- a/backend/onyx/background/celery/apps/primary.py +++ b/backend/onyx/background/celery/apps/primary.py @@ -1,3 +1,4 @@ +import logging import multiprocessing from typing import Any from typing import cast @@ -194,6 +195,10 @@ def on_setup_logging( ) -> None: app_base.on_setup_logging(loglevel, logfile, format, colorize, **kwargs) + # this can be spammy, so just enable it in the cloud for now + if MULTI_TENANT: + app_base.set_task_finished_log_level(logging.INFO) + class HubPeriodicTask(bootsteps.StartStopStep): """Regularly reacquires the primary worker lock outside of the task queue.