[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] Fix log file rotation



commit 99e3ee0d31da5ee993ef12fa96f7f5d7e960bdb3
Author: Matt Traudt <sirmatt@xxxxxxx>
Date:   Thu Jul 19 13:41:17 2018 -0400

    Fix log file rotation
---
 CHANGELOG.md        | 4 ++++
 sbws/util/config.py | 8 +++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ddd7f21..604811e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 - Document at which times should v3bw files be generated (#26740)
 - Remove test data v3bw file and generate it from the same test. (#26736)
 
+### Fixed
+
+- Log files weren't rotating. Now they are. (#26881)
+
 ## [0.6.0] - 2018-07-11
 
 **Important changes**:
diff --git a/sbws/util/config.py b/sbws/util/config.py
index bfd828c..f7389ef 100644
--- a/sbws/util/config.py
+++ b/sbws/util/config.py
@@ -125,12 +125,14 @@ def configure_logging(args, conf):
         dname = conf['paths']['log_dname']
         os.makedirs(dname, exist_ok=True)
         fname = os.path.join(dname, '{}.log'.format(args.command or 'sbws'))
-        # The second argument is the number of backups to keep, and the third
-        # is the maximum file size (in bytes) each log file should be.
+        # The second argument is the file mode, and it should be left alone
+        mode = 'a'
+        # The third is the maximum file size (in bytes) each log file should be
         max_bytes = conf.getint('logging', 'to_file_max_bytes')
+        # And the forth is the number of backups to keep
         num_backups = conf.getint('logging', 'to_file_num_backups')
         # Now store those things as a string in the config. So dumb.
-        conf['handler_to_file']['args'] = str((fname, num_backups, max_bytes))
+        conf['handler_to_file']['args'] = str((fname, mode, max_bytes, num_backups))
     # Set some stuff that needs config parser's interpolation
     conf['formatter_to_file']['format'] = conf['logging']['to_file_format']
     conf['formatter_to_stdout']['format'] = conf['logging']['to_stdout_format']



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits