version: 1

formatters:
    precise:
        format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
    journal:
        format: '%(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'

handlers:
    file:
        class: logging.handlers.TimedRotatingFileHandler
        formatter: precise
        filename: /var/log/matrix-synapse/homeserver.log
        when: midnight
        backupCount: 1  # Does not include the current log file.
        encoding: utf8
    buffer:
        class: synapse.logging.handlers.PeriodicallyFlushingMemoryHandler
        target: file
        capacity: 10
        flushLevel: 30  # Flush immediately for WARNING logs and higher
        period: 5
    console:
        class: logging.StreamHandler
        formatter: journal

loggers:
    synapse.storage.SQL:
        level: WARNING

root:
    level: WARNING
    handlers: [buffer]

disable_existing_loggers: false
