deploy: 6902e9ff2b
This commit is contained in:
@@ -215,75 +215,6 @@ loggers:
|
||||
<p>The above logging config will set Synapse as 'INFO' logging level by default,
|
||||
with the SQL layer at 'WARNING', and will log JSON formatted messages to a
|
||||
remote endpoint at 10.1.2.3:9999.</p>
|
||||
<h2 id="upgrading-from-legacy-structured-logging-configuration"><a class="header" href="#upgrading-from-legacy-structured-logging-configuration">Upgrading from legacy structured logging configuration</a></h2>
|
||||
<p>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.</p>
|
||||
<p>The following reference can be used to update your configuration. Based on the
|
||||
drain <code>type</code>, we can pick a new handler:</p>
|
||||
<ol>
|
||||
<li>For a type of <code>console</code>, <code>console_json</code>, or <code>console_json_terse</code>: a handler
|
||||
with a class of <code>logging.StreamHandler</code> and a <code>stream</code> of <code>ext://sys.stdout</code>
|
||||
or <code>ext://sys.stderr</code> should be used.</li>
|
||||
<li>For a type of <code>file</code> or <code>file_json</code>: a handler of <code>logging.FileHandler</code> with
|
||||
a location of the file path should be used.</li>
|
||||
<li>For a type of <code>network_json_terse</code>: a handler of <code>synapse.logging.RemoteHandler</code>
|
||||
with the host and port should be used.</li>
|
||||
</ol>
|
||||
<p>Then based on the drain <code>type</code> we can pick a new formatter:</p>
|
||||
<ol>
|
||||
<li>For a type of <code>console</code> or <code>file</code> no formatter is necessary.</li>
|
||||
<li>For a type of <code>console_json</code> or <code>file_json</code>: a formatter of
|
||||
<code>synapse.logging.JsonFormatter</code> should be used.</li>
|
||||
<li>For a type of <code>console_json_terse</code> or <code>network_json_terse</code>: a formatter of
|
||||
<code>synapse.logging.TerseJsonFormatter</code> should be used.</li>
|
||||
</ol>
|
||||
<p>For each new handler and formatter they should be added to the logging configuration
|
||||
and then assigned to either a logger or the root logger.</p>
|
||||
<p>An example legacy configuration:</p>
|
||||
<pre><code class="language-yaml">structured: true
|
||||
|
||||
loggers:
|
||||
synapse:
|
||||
level: INFO
|
||||
synapse.storage.SQL:
|
||||
level: WARNING
|
||||
|
||||
drains:
|
||||
console:
|
||||
type: console
|
||||
location: stdout
|
||||
file:
|
||||
type: file_json
|
||||
location: homeserver.log
|
||||
</code></pre>
|
||||
<p>Would be converted into a new configuration:</p>
|
||||
<pre><code class="language-yaml">version: 1
|
||||
|
||||
formatters:
|
||||
json:
|
||||
class: synapse.logging.JsonFormatter
|
||||
|
||||
handlers:
|
||||
console:
|
||||
class: logging.StreamHandler
|
||||
stream: ext://sys.stdout
|
||||
file:
|
||||
class: logging.FileHandler
|
||||
formatter: json
|
||||
filename: homeserver.log
|
||||
|
||||
loggers:
|
||||
synapse:
|
||||
level: INFO
|
||||
handlers: [console, file]
|
||||
synapse.storage.SQL:
|
||||
level: WARNING
|
||||
</code></pre>
|
||||
<p>The new logging configuration is a bit more verbose, but significantly more
|
||||
flexible. It allows for configuration that were not previously possible, such as
|
||||
sending plain logs over the network, or using different handlers for different
|
||||
modules.</p>
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user