Skip to content

Commit

Permalink
vstart_runner: maintain log level when --debug is passed
Browse files Browse the repository at this point in the history
When --debug and --clear-old-log options are passed to vstart_runner.py,
it ends up resetting log level to the default level (which is
logging.INFO) despite of --debug. Set "log_level" as default parameter
to init_log() so that the log level code for clearing old log can pass
current logging level to init_log() to maintain the log level user
desired for.

Fixes: https://tracker.ceph.com/issues/51344
Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 73567a1)
  • Loading branch information
rishabh-d-dave authored and k0ste committed Oct 14, 2023
1 parent 129959f commit 107b936
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions qa/tasks/vstart_runner.py
Expand Up @@ -63,7 +63,7 @@
except:
pass

def init_log():
def init_log(log_level=logging.INFO):
global log
if log is not None:
del log
Expand All @@ -78,7 +78,7 @@ def init_log():
datefmt='%Y-%m-%dT%H:%M:%S')
handler.setFormatter(formatter)
log.addHandler(handler)
log.setLevel(logging.INFO)
log.setLevel(log_level)

log = None
init_log()
Expand Down Expand Up @@ -1344,7 +1344,7 @@ def clear_old_log():
os.remove(logpath)
with open(logpath, 'w') as logfile:
logfile.write('')
init_log()
init_log(log.level)
log.debug('logging in a fresh file now...')


Expand Down

0 comments on commit 107b936

Please sign in to comment.