aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-05-30 18:16:52 +0000
committerRob Austein <sra@hactrn.net>2014-05-30 18:16:52 +0000
commit94b35d3ccccc2b3d75f5b634870c4b53e953a5fc (patch)
tree9570d47d7614325395d6139510f3c1ba658cc005
parent2d305515c1cd0ed81475a0f8d4dcc20f29f050b1 (diff)
Use --log-file in yamltest; debug the rotating log file options.
svn path=/trunk/; revision=5853
-rw-r--r--ca/tests/yamltest.py14
-rw-r--r--rpki/log.py4
2 files changed, 8 insertions, 10 deletions
diff --git a/ca/tests/yamltest.py b/ca/tests/yamltest.py
index 59d58cd9..a2390aff 100644
--- a/ca/tests/yamltest.py
+++ b/ca/tests/yamltest.py
@@ -554,15 +554,13 @@ class allocation(object):
representing the running daemon.
"""
basename = os.path.splitext(os.path.basename(prog))[0]
- cmd = [prog, "--foreground", "--log-stderr", "--log-level", "debug", "--config", self.path("rpki.conf")]
+ cmd = [prog, "--foreground", "--log-level", "debug",
+ "--log-file", self.path(basename + ".log"),
+ "--config", self.path("rpki.conf")]
if args.profile and basename != "rootd":
- cmd.append("--profile")
- cmd.append(self.path(basename + ".prof"))
- log = basename + ".log"
- p = subprocess.Popen(cmd,
- cwd = self.path(),
- stdout = open(self.path(log), "w"),
- stderr = subprocess.STDOUT)
+ cmd.extend((
+ "--profile", self.path(basename + ".prof")))
+ p = subprocess.Popen(cmd, cwd = self.path())
print 'Running %s for %s: pid %d process %r' % (" ".join(cmd), self.name, p.pid, p)
return p
diff --git a/rpki/log.py b/rpki/log.py
index a4493b0e..32ded80f 100644
--- a/rpki/log.py
+++ b/rpki/log.py
@@ -157,7 +157,7 @@ def argparse_setup(parser, default_thunk = None):
namespace.log_handler = lambda: logging.handlers.WatchedFileHandler(filename = values)
group.add_argument("--log-file", action = WatchedFileAction,
- help = "send logging to a file, reopening if newsyslog rotates it away")
+ help = "send logging to a file, reopening if rotated away")
class RotatingFileAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string = None):
@@ -172,7 +172,7 @@ def argparse_setup(parser, default_thunk = None):
class TimedRotatingFileAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string = None):
- namespace.log_handler = logging.handlers.RotatingFileHandler(
+ namespace.log_handler = lambda: logging.handlers.TimedRotatingFileHandler(
filename = values[0],
interval = int(values[1]),
backupCount = int(values[2]),