]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
vstart_runner: maintain log level when --debug is passed 52977/head
authorRishabh Dave <ridave@redhat.com>
Wed, 23 Jun 2021 12:17:59 +0000 (17:47 +0530)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Sat, 14 Oct 2023 08:02:38 +0000 (15:02 +0700)
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 73567a14472d27b3e3f7e774065137c17e67102e)

qa/tasks/vstart_runner.py

index c88c93b80ec01f5d1d4d1cf6f69fcb6d1bd870ef..a03d25ae203d4f53c1c14e8b4134160f276e3db5 100644 (file)
@@ -63,7 +63,7 @@ try:
 except:
     pass
 
-def init_log():
+def init_log(log_level=logging.INFO):
     global log
     if log is not None:
         del log
@@ -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()
@@ -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...')