From ddbea3416465db655da3ae4e87d2b5b975c2a991 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Mon, 27 Jan 2020 19:27:44 +0500 Subject: [PATCH] dynamic debug logging --- plogical/processUtilities.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py index 7bf29cb21..b2d76a76a 100755 --- a/plogical/processUtilities.py +++ b/plogical/processUtilities.py @@ -9,6 +9,7 @@ import getpass import codecs class ProcessUtilities(multi.Thread): + debugPath = '/home/cyberpanel/debug' litespeedProcess = "litespeed" ent = 1 OLS = 0 @@ -187,12 +188,14 @@ class ProcessUtilities(multi.Thread): sock = ret[0] if user == None: - #logging.writeToFile(ProcessUtilities.token + command) + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(ProcessUtilities.token + command) sock.sendall((ProcessUtilities.token + command).encode('utf-8')) else: command = '%s-u %s %s' % (ProcessUtilities.token, user, command) command = command.replace('sudo', '') - #logging.writeToFile(command) + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(command) sock.sendall(command.encode('utf-8')) data = ""