devserver: rotate devserver log twice a day.

This CL changes devserver log's rotation to twice a day.

BUG=chromium:656829
TEST=test it locally with setting rotation to every 30s, verify it
works.

Change-Id: Ie7843dcb2e7f4191eed24f3b62f9cde65d46dbf4
Reviewed-on: https://chromium-review.googlesource.com/435021
Commit-Ready: Xixuan Wu <[email protected]>
Tested-by: Xixuan Wu <[email protected]>
Reviewed-by: Xixuan Wu <[email protected]>
diff --git a/devserver.py b/devserver.py
index d9f95f8..7aa81c6 100755
--- a/devserver.py
+++ b/devserver.py
@@ -115,14 +115,15 @@
 # Sets up global to share between classes.
 updater = None
 
-# Log rotation parameters.  These settings correspond to once a week
-# at midnight between Friday and Saturday, with about three months
-# of old logs kept for backup.
+# Log rotation parameters.  These settings correspond to twice a day once
+# devserver is started, with about two weeks (28 backup files) of old logs
+# kept for backup.
 #
-# For more, see the documentation for
+# For more, see the documentation in standard python library for
 # logging.handlers.TimedRotatingFileHandler
-_LOG_ROTATION_TIME = 'W4'
-_LOG_ROTATION_BACKUP = 13
+_LOG_ROTATION_TIME = 'H'
+_LOG_ROTATION_INTERVAL = 12 # hours
+_LOG_ROTATION_BACKUP = 28 # backup counts
 
 # Number of seconds between the collection of disk and network IO counters.
 STATS_INTERVAL = 10.0
@@ -1674,6 +1675,7 @@
   """Create a LogHandler instance used to log all messages."""
   hdlr_cls = handlers.TimedRotatingFileHandler
   hdlr = hdlr_cls(logfile, when=_LOG_ROTATION_TIME,
+                  interval=_LOG_ROTATION_INTERVAL,
                   backupCount=_LOG_ROTATION_BACKUP)
   hdlr.setFormatter(cplogging.logfmt)
   return hdlr