summary refs log tree commit diff
path: root/synapse/config
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-01-08 15:31:06 +0000
committerKegan Dougal <kegan@matrix.org>2015-01-08 15:31:29 +0000
commit9d0dcf2e3ca8b8c9cc8d87a451ed901f102dc2c6 (patch)
treea08c179c33139cff153ea69d622e29f8acb33000 /synapse/config
parentmake our JPEG thumbnail quality less horrifically ugly (diff)
downloadsynapse-9d0dcf2e3ca8b8c9cc8d87a451ed901f102dc2c6.tar.xz
SYN-142: Rotate logs if logging to file. Fixed to a 4 file rotate with 100MB/file for now.
Diffstat (limited to 'synapse/config')
-rw-r--r--synapse/config/logger.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/config/logger.py b/synapse/config/logger.py
index 15383b3184..f9568ebd21 100644
--- a/synapse/config/logger.py
+++ b/synapse/config/logger.py
@@ -66,7 +66,10 @@ class LoggingConfig(Config):
 
             formatter = logging.Formatter(log_format)
             if self.log_file:
-                handler = logging.FileHandler(self.log_file)
+                # TODO: Customisable file size / backup count
+                handler = logging.handlers.RotatingFileHandler(
+                    self.log_file, maxBytes=(1000 * 1000 * 100), backupCount=3
+                )
             else:
                 handler = logging.StreamHandler()
             handler.setFormatter(formatter)