diff --git a/mpsd-software-environment.py b/mpsd-software-environment.py
index 496466a241c832bcd623df2a6571658c265f4812..5a78c284360bad5e838d473f635b338882d30852 100755
--- a/mpsd-software-environment.py
+++ b/mpsd-software-environment.py
@@ -910,9 +910,8 @@ def main():
 
     # target dir is the place where this script exists. the
     script_dir = Path(os.path.dirname(os.path.realpath(__file__)))
-    installer_log_file = get_installer_log_file(args, script_dir)
 
-    set_up_logging(args.loglevel, installer_log_file)
+    set_up_logging(args.loglevel, get_installer_log_file(args, script_dir))
 
     # Check the command and run related function
     if args.action == "remove":