summary refs log tree commit diff
path: root/docs/sample_log_config.yaml
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-08-07 11:39:29 +0100
committerErik Johnston <erik@matrix.org>2020-08-11 18:10:46 +0100
commit0304ad0c3d79e44e78f9658e71f1e1533e3aa4e2 (patch)
tree4e439b0145e8eb2c8ff4fe27c8048fe4be265fe6 /docs/sample_log_config.yaml
parentReduce INFO logging (#8050) (diff)
downloadsynapse-0304ad0c3d79e44e78f9658e71f1e1533e3aa4e2.tar.xz
Move setting of Filter into code.
We do this to prevent foot guns. The default config uses a MemoryFilter,
but users are free to change to logging to files directly. If they do
then they have to ensure to set the `filters: [context]` on the right
handler, otherwise records get written with the wrong context.

Instead we move the logic to happen when we generate a record, which is
when we *log* rather than *handle*.

(It's possible to add filters to loggers in the config, however they
don't apply to descendant loggers and so they have to be manually set on
*every* logger used in the code base)
Diffstat (limited to 'docs/sample_log_config.yaml')
-rw-r--r--docs/sample_log_config.yaml7
1 files changed, 0 insertions, 7 deletions
diff --git a/docs/sample_log_config.yaml b/docs/sample_log_config.yaml
index 403ac005ee..55a48a9ed6 100644
--- a/docs/sample_log_config.yaml
+++ b/docs/sample_log_config.yaml
@@ -11,11 +11,6 @@ formatters:
     precise:
         format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
 
-filters:
-    context:
-        (): synapse.logging.context.LoggingContextFilter
-        request: ""
-
 handlers:
     file:
         class: logging.handlers.TimedRotatingFileHandler
@@ -30,7 +25,6 @@ handlers:
     # logs will still be flushed immediately.
     buffer:
         class: logging.handlers.MemoryHandler
-        filters: [context]
         target: file
         # The capacity is the number of log lines that are buffered before
         # being written to disk. Increasing this will lead to better
@@ -44,7 +38,6 @@ handlers:
     console:
         class: logging.StreamHandler
         formatter: precise
-        filters: [context]
 
 loggers:
     synapse.storage.SQL: