From c9a0f4ea66533680d06d65658f3fe5cf90b1fa92 Mon Sep 17 00:00:00 2001 From: donoban Date: Sat, 13 Feb 2021 00:38:52 +0100 Subject: [PATCH] Parse logLevel from /etc/qmemman.conf --- etc/qmemman.conf | 4 ++++ qubes/tools/qmemmand.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/qmemman.conf b/etc/qmemman.conf index f43daa9f..e86c158f 100644 --- a/etc/qmemman.conf +++ b/etc/qmemman.conf @@ -11,3 +11,7 @@ dom0-mem-boost = 350M # cache-margin-factor - calculate VM preferred memory as (used memory)*cache-margin-factor # Default: 1.3 cache-margin-factor = 1.3 + +# log-level - Warning 30, Info 20, Debug 10 +# Default: 30 +log-level = 30 diff --git a/qubes/tools/qmemmand.py b/qubes/tools/qmemmand.py index 7fbab9e6..4ffdcce4 100644 --- a/qubes/tools/qmemmand.py +++ b/qubes/tools/qmemmand.py @@ -250,8 +250,6 @@ def main(): sys.stdin.close() - logging.root.setLevel(parser.get_loglevel_from_verbosity(args)) - log = logging.getLogger('qmemman.daemon') config = configparser.SafeConfigParser({ @@ -268,6 +266,8 @@ def main(): qubes.utils.parse_size(config.get('global', 'dom0-mem-boost')) qubes.qmemman.algo.CACHE_FACTOR = \ config.getfloat('global', 'cache-margin-factor') + loglevel = config.getint('global', 'log-level') + logging.root.setLevel(loglevel) log.info('MIN_PREFMEM={algo.MIN_PREFMEM}' ' DOM0_MEM_BOOST={algo.DOM0_MEM_BOOST}'