From 40f22d3ee1808d6dd0dd42a2848d0e1899192e0d Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Wed, 19 Mar 2014 04:31:29 -0700 Subject: [PATCH] cli: add a default log file Now that the packages include /var/log/ceph/radosgw-agent, default to storing logs there, named after the configuration file or radosgw-agent.log if no config file was used. Signed-off-by: Josh Durgin --- radosgw_agent/cli.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/radosgw_agent/cli.py b/radosgw_agent/cli.py index 48b19e7..5a81fc2 100644 --- a/radosgw_agent/cli.py +++ b/radosgw_agent/cli.py @@ -3,6 +3,7 @@ import argparse import contextlib import logging import logging.handlers +import os.path import yaml import sys @@ -32,9 +33,14 @@ def parse_args(): help='configuration file' ) args, remaining = conf_parser.parse_known_args() + log_dir = '/var/log/ceph/radosgw-agent/' + log_file = 'radosgw-agent.log' + if args.conf is not None: + log_file = os.path.basename(args.conf.name) defaults = dict( sync_scope='incremental', log_lock_time=20, + log_file=os.path.join(log_dir, log_file), ) if args.conf is not None: with contextlib.closing(args.conf): -- 2.47.3