diff --git a/zerver/decorator.py b/zerver/decorator.py index 53cf4b5ff0..b49092cb20 100644 --- a/zerver/decorator.py +++ b/zerver/decorator.py @@ -34,7 +34,6 @@ from zerver.lib.exceptions import ( OrganizationOwnerRequired, UnsupportedWebhookEventType, ) -from zerver.lib.logging_util import log_to_file from zerver.lib.queue import queue_json_publish from zerver.lib.rate_limiter import RateLimitedUser from zerver.lib.request import REQ, has_request_variables @@ -50,11 +49,7 @@ if settings.ZILENCER_ENABLED: from zilencer.models import RemoteZulipServer, get_remote_server_by_uuid webhook_logger = logging.getLogger("zulip.zerver.webhooks") -log_to_file(webhook_logger, settings.WEBHOOK_LOG_PATH) - webhook_unsupported_events_logger = logging.getLogger("zulip.zerver.webhooks.unsupported") -log_to_file(webhook_unsupported_events_logger, - settings.WEBHOOK_UNSUPPORTED_EVENTS_LOG_PATH) FuncT = TypeVar('FuncT', bound=Callable[..., object]) diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py index 1b3a29dfb6..2409066c80 100644 --- a/zproject/computed_settings.py +++ b/zproject/computed_settings.py @@ -791,6 +791,18 @@ LOGGING: Dict[str, Any] = { 'formatter': 'default', 'filename': SLOW_QUERIES_LOG_PATH, }, + 'webhook_file': { + 'level': 'DEBUG', + 'class': 'logging.handlers.WatchedFileHandler', + 'formatter': 'default', + 'filename': WEBHOOK_LOG_PATH, + }, + 'webhook_unsupported_file': { + 'level': 'DEBUG', + 'class': 'logging.handlers.WatchedFileHandler', + 'formatter': 'default', + 'filename': WEBHOOK_UNSUPPORTED_EVENTS_LOG_PATH, + }, }, 'loggers': { # The Python logging module uses a hierarchy of logger names for config: @@ -937,12 +949,12 @@ LOGGING: Dict[str, Any] = { }, 'zulip.zerver.webhooks': { 'level': 'DEBUG', - 'handlers': ['file', 'errors_file'], + 'handlers': ['webhook_file'], 'propagate': False, }, 'zulip.zerver.webhooks.unsupported': { 'level': 'DEBUG', - 'handlers': ['file', 'errors_file'], + 'handlers': ['webhook_unsupported_file'], 'propagate': False, }, },