Loading src/jama/settings.py +24 −0 Original line number Diff line number Diff line Loading @@ -300,6 +300,23 @@ USE_TZ = True STATIC_ROOT = os.getenv("JAMA_STATIC_ROOT") or Path(VAR_DIR, "static") STATIC_URL = JAMA_URL_BASE_PATH + "/static/" def ignore_spammy_task_logs(record): """ Silences log messages for certain especially spammy tasks. (see https://github.com/codingjoe/django-crontask/discussions/18 ) """ # NOTE: If you need to debug this function by adding print statements, you MUST # use print("message", flush=True), or your prints will never appear. spammy_task_messages = [ # These get emitted every 5 seconds due to an implementation detail in django-crontask. "crontask.utils.lock.extend", # This hides all but the ﮩ٨ـﮩﮩ٨ـ♡ﮩ٨ـﮩﮩ٨ـ log from our custom heartbeat task. "heartbeat_task", ] return not any(message in record.getMessage() for message in spammy_task_messages) LOGGING = { "version": 1, "disable_existing_loggers": False, Loading @@ -307,11 +324,18 @@ LOGGING = { "console": {"format": "%(asctime)s %(name)-12s %(levelname)-8s %(message)s"}, "file": {"format": "%(asctime)s %(name)-12s %(levelname)-8s %(message)s"}, }, "filters": { "ignore_spammy_task_logs": { "()": "django.utils.log.CallbackFilter", "callback": ignore_spammy_task_logs, }, }, "handlers": { "console": { "level": "INFO", "class": "logging.StreamHandler", "formatter": "console", "filters": ["ignore_spammy_task_logs"], }, }, "loggers": { Loading Loading
src/jama/settings.py +24 −0 Original line number Diff line number Diff line Loading @@ -300,6 +300,23 @@ USE_TZ = True STATIC_ROOT = os.getenv("JAMA_STATIC_ROOT") or Path(VAR_DIR, "static") STATIC_URL = JAMA_URL_BASE_PATH + "/static/" def ignore_spammy_task_logs(record): """ Silences log messages for certain especially spammy tasks. (see https://github.com/codingjoe/django-crontask/discussions/18 ) """ # NOTE: If you need to debug this function by adding print statements, you MUST # use print("message", flush=True), or your prints will never appear. spammy_task_messages = [ # These get emitted every 5 seconds due to an implementation detail in django-crontask. "crontask.utils.lock.extend", # This hides all but the ﮩ٨ـﮩﮩ٨ـ♡ﮩ٨ـﮩﮩ٨ـ log from our custom heartbeat task. "heartbeat_task", ] return not any(message in record.getMessage() for message in spammy_task_messages) LOGGING = { "version": 1, "disable_existing_loggers": False, Loading @@ -307,11 +324,18 @@ LOGGING = { "console": {"format": "%(asctime)s %(name)-12s %(levelname)-8s %(message)s"}, "file": {"format": "%(asctime)s %(name)-12s %(levelname)-8s %(message)s"}, }, "filters": { "ignore_spammy_task_logs": { "()": "django.utils.log.CallbackFilter", "callback": ignore_spammy_task_logs, }, }, "handlers": { "console": { "level": "INFO", "class": "logging.StreamHandler", "formatter": "console", "filters": ["ignore_spammy_task_logs"], }, }, "loggers": { Loading