1
0

log.config 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. version: 1
  2. formatters:
  3. precise:
  4. format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
  5. handlers:
  6. {% if LOG_FILE_PATH %}
  7. file:
  8. class: logging.handlers.TimedRotatingFileHandler
  9. formatter: precise
  10. filename: {{ LOG_FILE_PATH }}
  11. when: "midnight"
  12. backupCount: 6 # Does not include the current log file.
  13. encoding: utf8
  14. # Default to buffering writes to log file for efficiency.
  15. # WARNING/ERROR logs will still be flushed immediately, but there will be a
  16. # delay (of up to `period` seconds, or until the buffer is full with
  17. # `capacity` messages) before INFO/DEBUG logs get written.
  18. buffer:
  19. class: synapse.logging.handlers.PeriodicallyFlushingMemoryHandler
  20. target: file
  21. # The capacity is the maximum number of log lines that are buffered
  22. # before being written to disk. Increasing this will lead to better
  23. # performance, at the expensive of it taking longer for log lines to
  24. # be written to disk.
  25. # This parameter is required.
  26. capacity: 10
  27. # Logs with a level at or above the flush level will cause the buffer to
  28. # be flushed immediately.
  29. # Default value: 40 (ERROR)
  30. # Other values: 50 (CRITICAL), 30 (WARNING), 20 (INFO), 10 (DEBUG)
  31. flushLevel: 30 # Flush immediately for WARNING logs and higher
  32. # The period of time, in seconds, between forced flushes.
  33. # Messages will not be delayed for longer than this time.
  34. # Default value: 5 seconds
  35. period: 5
  36. {% endif %}
  37. console:
  38. class: logging.StreamHandler
  39. formatter: precise
  40. loggers:
  41. synapse.storage.SQL:
  42. # beware: increasing this to DEBUG will make synapse log sensitive
  43. # information such as access tokens.
  44. level: INFO
  45. root:
  46. level: {{ SYNAPSE_LOG_LEVEL or "INFO" }}
  47. {% if LOG_FILE_PATH %}
  48. handlers: [console, buffer]
  49. {% else %}
  50. handlers: [console]
  51. {% endif %}
  52. disable_existing_loggers: false