mirror of https://github.com/zulip/zulip.git
webhooks: Configure webhook loggers in zproject/computed_settings.py.
This limits the webhook errors to only go to their respective log files, and not to the general server logs.
This commit is contained in:
parent
006875e7d0
commit
b8a2e6b5f8
|
@ -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])
|
||||
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue