@@ -78,82 +78,3 @@ loggers:
78
78
The above logging config will set Synapse as 'INFO' logging level by default,
79
79
with the SQL layer at 'WARNING', and will log JSON formatted messages to a
80
80
remote endpoint at 10.1.2.3:9999.
81
-
82
- # # Upgrading from legacy structured logging configuration
83
-
84
- Versions of Synapse prior to v1.54.0 automatically converted the legacy
85
- structured logging configuration, which was deprecated in v1.23.0, to the standard
86
- library logging configuration.
87
-
88
- The following reference can be used to update your configuration. Based on the
89
- drain `type`, we can pick a new handler :
90
-
91
- 1. For a type of `console`, `console_json`, or `console_json_terse` : a handler
92
- with a class of `logging.StreamHandler` and a `stream` of `ext://sys.stdout`
93
- or `ext://sys.stderr` should be used.
94
- 2. For a type of `file` or `file_json` : a handler of `logging.FileHandler` with
95
- a location of the file path should be used.
96
- 3. For a type of `network_json_terse` : a handler of `synapse.logging.RemoteHandler`
97
- with the host and port should be used.
98
-
99
- Then based on the drain `type` we can pick a new formatter :
100
-
101
- 1. For a type of `console` or `file` no formatter is necessary.
102
- 2. For a type of `console_json` or `file_json` : a formatter of
103
- ` synapse.logging.JsonFormatter` should be used.
104
- 3. For a type of `console_json_terse` or `network_json_terse` : a formatter of
105
- ` synapse.logging.TerseJsonFormatter` should be used.
106
-
107
- For each new handler and formatter they should be added to the logging configuration
108
- and then assigned to either a logger or the root logger.
109
-
110
- An example legacy configuration :
111
-
112
- ` ` ` yaml
113
- structured: true
114
-
115
- loggers:
116
- synapse:
117
- level: INFO
118
- synapse.storage.SQL:
119
- level: WARNING
120
-
121
- drains:
122
- console:
123
- type: console
124
- location: stdout
125
- file:
126
- type: file_json
127
- location: homeserver.log
128
- ` ` `
129
-
130
- Would be converted into a new configuration :
131
-
132
- ` ` ` yaml
133
- version: 1
134
-
135
- formatters:
136
- json:
137
- class: synapse.logging.JsonFormatter
138
-
139
- handlers:
140
- console:
141
- class: logging.StreamHandler
142
- stream: ext://sys.stdout
143
- file:
144
- class: logging.FileHandler
145
- formatter: json
146
- filename: homeserver.log
147
-
148
- loggers:
149
- synapse:
150
- level: INFO
151
- handlers: [console, file]
152
- synapse.storage.SQL:
153
- level: WARNING
154
- ` ` `
155
-
156
- The new logging configuration is a bit more verbose, but significantly more
157
- flexible. It allows for configuration that were not previously possible, such as
158
- sending plain logs over the network, or using different handlers for different
159
- modules.
0 commit comments