Remove support for the legacy structured logging configuration. (#12008)

This commit is contained in:
Patrick Cloke 2022-02-17 08:32:18 -05:00 committed by GitHub
parent 696acd3515
commit e69f8f0a8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 174 deletions

View file

@ -33,7 +33,6 @@ from twisted.logger import (
globalLogBeginner,
)
from synapse.logging._structured import setup_structured_logging
from synapse.logging.context import LoggingContextFilter
from synapse.logging.filter import MetadataFilter
@ -138,6 +137,12 @@ Support for the log_file configuration option and --log-file command-line option
removed in Synapse 1.3.0. You should instead set up a separate log configuration file.
"""
STRUCTURED_ERROR = """\
Support for the structured configuration option was removed in Synapse 1.54.0.
You should instead use the standard logging configuration. See
https://matrix-org.github.io/synapse/v1.54/structured_logging.html
"""
class LoggingConfig(Config):
section = "logging"
@ -292,10 +297,9 @@ def _load_logging_config(log_config_path: str) -> None:
if not log_config:
logging.warning("Loaded a blank logging config?")
# If the old structured logging configuration is being used, convert it to
# the new style configuration.
# If the old structured logging configuration is being used, raise an error.
if "structured" in log_config and log_config.get("structured"):
log_config = setup_structured_logging(log_config)
raise ConfigError(STRUCTURED_ERROR)
logging.config.dictConfig(log_config)