Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Remove support for the legacy structured logging configuration. #12008

Merged
merged 4 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12008.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove support for the legacy structured logging configuration (using `structured: true` in the Synapse configuration).
clokep marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 6 additions & 8 deletions docs/structured_logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,12 @@ remote endpoint at 10.1.2.3:9999.

## Upgrading from legacy structured logging configuration

Versions of Synapse prior to v1.23.0 included a custom structured logging
configuration which is deprecated. It used a `structured: true` flag and
configured `drains` instead of ``handlers`` and `formatters`.

Synapse currently automatically converts the old configuration to the new
configuration, but this will be removed in a future version of Synapse. The
following reference can be used to update your configuration. Based on the drain
`type`, we can pick a new handler:
Versions of Synapse prior to v1.54.0 automatically converted the legacy
structured logging configuration, which was deprecated in v1.23.0, to the standard
library logging configuration.

The following reference can be used to update your configuration. Based on the
drain `type`, we can pick a new handler:

1. For a type of `console`, `console_json`, or `console_json_terse`: a handler
with a class of `logging.StreamHandler` and a `stream` of `ext://sys.stdout`
Expand Down
9 changes: 9 additions & 0 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ process, for example:
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
```

# Upgrading to v1.54.0

## Legacy structured logging configuration removal

This release removes support for the `structured: true` logging configuration
which was deprecated in Synapse v1.23.0. If your logging configuration contains
clokep marked this conversation as resolved.
Show resolved Hide resolved
`structured: true` then it should be modified based on the
[structured logging documentation](structured_logging.md).

# Upgrading to v1.53.0

## Dropping support for `webclient` listeners and non-HTTP(S) `web_client_location`
Expand Down
12 changes: 8 additions & 4 deletions synapse/config/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
globalLogBeginner,
)

from synapse.logging._structured import setup_structured_logging
from synapse.logging.context import LoggingContextFilter
from synapse.logging.filter import MetadataFilter

Expand Down Expand Up @@ -138,6 +137,12 @@
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.52/structured_logging.html
clokep marked this conversation as resolved.
Show resolved Hide resolved
"""


class LoggingConfig(Config):
section = "logging"
Expand Down Expand Up @@ -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)

Expand Down
163 changes: 0 additions & 163 deletions synapse/logging/_structured.py

This file was deleted.