1
0

sample_log_config.yaml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Log configuration for Synapse.
  2. #
  3. # This is a YAML file containing a standard Python logging configuration
  4. # dictionary. See [1] for details on the valid settings.
  5. #
  6. # [1]: https://docs.python.org/3.7/library/logging.config.html#configuration-dictionary-schema
  7. version: 1
  8. formatters:
  9. precise:
  10. format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
  11. handlers:
  12. file:
  13. class: logging.handlers.TimedRotatingFileHandler
  14. formatter: precise
  15. filename: /var/log/matrix-synapse/homeserver.log
  16. when: midnight
  17. backupCount: 3 # Does not include the current log file.
  18. encoding: utf8
  19. # Default to buffering writes to log file for efficiency. This means that
  20. # will be a delay for INFO/DEBUG logs to get written, but WARNING/ERROR
  21. # logs will still be flushed immediately.
  22. buffer:
  23. class: logging.handlers.MemoryHandler
  24. target: file
  25. # The capacity is the number of log lines that are buffered before
  26. # being written to disk. Increasing this will lead to better
  27. # performance, at the expensive of it taking longer for log lines to
  28. # be written to disk.
  29. capacity: 10
  30. flushLevel: 30 # Flush for WARNING logs as well
  31. # A handler that writes logs to stderr. Unused by default, but can be used
  32. # instead of "buffer" and "file" in the logger handlers.
  33. console:
  34. class: logging.StreamHandler
  35. formatter: precise
  36. loggers:
  37. synapse.storage.SQL:
  38. # beware: increasing this to DEBUG will make synapse log sensitive
  39. # information such as access tokens.
  40. level: INFO
  41. twisted:
  42. # We send the twisted logging directly to the file handler,
  43. # to work around https://github.com/matrix-org/synapse/issues/3471
  44. # when using "buffer" logger. Use "console" to log to stderr instead.
  45. handlers: [file]
  46. propagate: false
  47. root:
  48. level: INFO
  49. # Write logs to the `buffer` handler, which will buffer them together in memory,
  50. # then write them to a file.
  51. #
  52. # Replace "buffer" with "console" to log to stderr instead. (Note that you'll
  53. # also need to update the configuation for the `twisted` logger above, in
  54. # this case.)
  55. #
  56. handlers: [buffer]
  57. disable_existing_loggers: false