aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Casagrande <milo@ubuntu.com>2013-01-31 13:17:51 +0100
committerMilo Casagrande <milo@ubuntu.com>2013-01-31 13:17:51 +0100
commit8f9e327688237fd62a0fd62ee7221e612c22a49a (patch)
tree4591e2afffebef1f018bebd2d82d2700a90b58da
parent03aeb0ac436d0ec1e9f6bc8e138ed5669279e31e (diff)
downloadrhodecode-config-8f9e327688237fd62a0fd62ee7221e612c22a49a.tar.gz
Fixed small errors.
-rw-r--r--scripts/update-repos9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/update-repos b/scripts/update-repos
index 9831350..a72ce36 100644
--- a/scripts/update-repos
+++ b/scripts/update-repos
@@ -2,10 +2,10 @@
# Copyright (C) 2013 Linaro Ltd.
import argparse
+import logging
import os
import re
import subprocess
-import logging
from logging.handlers import TimedRotatingFileHandler
from tempfile import gettempdir
@@ -21,6 +21,10 @@ FILE_NAME = os.path.basename(__file__)
# Default log directory and log file.
DEFAULT_LOG_DIR = "/var/log/rhodecode"
LOG_FILE_NAME = FILE_NAME + ".log"
+# When to rotate logs.
+DEFAULT_ROTATING_TIME = 'midnight'
+# How many old logs to keep.
+KEEP_MAX_LOGS = 10
# Default logger.
logger = logging.getLogger(FILE_NAME)
@@ -55,7 +59,8 @@ def setup_logging(debug, log_dir):
log_file = os.path.join(log_dir, LOG_FILE_NAME)
timed_handler = TimedRotatingFileHandler(log_file,
- when='midnight')
+ when=DEFAULT_ROTATING_TIME,
+ backupCount=KEEP_MAX_LOGS)
timed_handler.setFormatter(logging.Formatter(th_formatter))
if debug: