diff --git a/Orchestrator/Settings/AccessUser_ND.py b/Orchestrator/Settings/AccessUser_ND.py index 05f73397..f489560f 100644 --- a/Orchestrator/Settings/AccessUser_ND.py +++ b/Orchestrator/Settings/AccessUser_ND.py @@ -1,14 +1,4 @@ def SettingsUpdate(inDict): - ################################################# - #General MethodMatchURL list (no domain/user) - lRuleMethodMatchURLBeforeList=[ - { - "Method":"GET", - "MatchType":"Equal", - "URL":"/", - "FlagAccess": True - } - ] #Append to global list inDict["Server"]["AccessUsers"]["RuleMethodMatchURLBeforeList"]=inDict["Server"]["AccessUsers"]["RuleMethodMatchURLBeforeList"]+lRuleMethodMatchURLBeforeList ################################################## diff --git a/Orchestrator/Settings/Settings.py b/Orchestrator/Settings/Settings.py index 00793fc9..9a7e7ab8 100644 --- a/Orchestrator/Settings/Settings.py +++ b/Orchestrator/Settings/Settings.py @@ -1,5 +1,6 @@ import psutil import datetime +import logging def RenderRobotR01(inGlobalConfiguration): #Subheader Variants @@ -81,7 +82,7 @@ def Settings(): "URL": "http://127.0.0.1:8081" } ], - "AccessUsers": { #Defaul - all URL is blocked + "AccessUsers": { #Default - all URL is blocked "FlagCredentialsAsk": True, #Turn on Authentication "RuleDomainUserDict": { #("DOMAIN", "USER"): { #upper case @@ -96,7 +97,7 @@ def Settings(): # ] #} }, - "RuleMethodMatchURLBeforeList": [ + "RuleMethodMatchURLBeforeList": [ #General MethodMatchURL list (no domain/user) # { # "Method":"GET|POST", # "MatchType":"BeginWith|Contains|Equal|EqualCase", @@ -185,11 +186,28 @@ def Settings(): "r01/report.xlsx": "C:\\RPA\\R01_IntegrationOrderOut\\Data\\Reestr_otgruzok.xlsx" } }, + "Logger": logging.getLogger("Orchestrator"), "Storage": { "Robot_R01_help": "Robot data storage in orchestrator env", "Robot_R01": {} } } + #Создать файл логирования + # add filemode="w" to overwrite + if not os.path.exists("Reports"): + os.makedirs("Reports") + ########################## + #Подготовка логгера Robot + ######################### + mRobotLogger=mDict["Logger"] + mRobotLogger.setLevel(logging.INFO) + # create the logging file handler + mRobotLoggerFH = logging.FileHandler("Reports\ReportOrchestrator_"+datetime.datetime.now().strftime("%Y_%m_%d")+".log") + mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') + mRobotLoggerFH.setFormatter(mRobotLoggerFormatter) + # add handler to logger object + mRobotLogger.addHandler(mRobotLoggerFH) + ############################################ ################################### #Init .py files from Settings folder #################################### diff --git a/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_Studio.exe b/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_Studio.exe new file mode 100644 index 00000000..66a6265c Binary files /dev/null and b/Resources/WPy64-3720/python-3.7.2.amd64/OpenRPA_Studio.exe differ diff --git a/Sources/pyOpenRPA/Orchestrator/Orchestrator.py b/Sources/pyOpenRPA/Orchestrator/Orchestrator.py index 1cc29ae0..04a4ca5b 100644 --- a/Sources/pyOpenRPA/Orchestrator/Orchestrator.py +++ b/Sources/pyOpenRPA/Orchestrator/Orchestrator.py @@ -15,11 +15,6 @@ import copy #from .Settings import Settings import importlib from importlib import util -#Создать файл логирования -# add filemode="w" to overwrite -if not os.path.exists("Reports"): - os.makedirs("Reports") -logging.basicConfig(filename="Reports\ReportRun_"+datetime.datetime.now().strftime("%Y_%m_%d__%H_%M_%S")+".log", level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s") #Единый глобальный словарь (За основу взять из Settings.py) global mGlobalDict @@ -51,6 +46,8 @@ lDaemonStartDateTime=datetime.datetime.now() #Инициализация сервера lThreadServer = Server.RobotDaemonServer("ServerThread", mGlobalDict) lThreadServer.start() +#Logging +mGlobalDict["Logger"].info("Scheduler loop init") #Вечный цикл while True: lCurrentDateTime = datetime.datetime.now() diff --git a/Sources/pyOpenRPA/Orchestrator/Server.py b/Sources/pyOpenRPA/Orchestrator/Server.py index 44d4801b..a7a44dc8 100644 --- a/Sources/pyOpenRPA/Orchestrator/Server.py +++ b/Sources/pyOpenRPA/Orchestrator/Server.py @@ -22,12 +22,14 @@ class RobotDaemonServer(Thread): def run(self): inServerAddress=""; inPort = mGlobalDict["Server"]["ListenPort"]; - print('starting server..., port:'+str(inPort)+" inAddress:"+inServerAddress) + #print('starting server..., port:'+str(inPort)+" inAddress:"+inServerAddress) # Server settings # Choose port 8080, for port 80, which is normally used for a http server, you need root access server_address = (inServerAddress, inPort) httpd = HTTPServer(server_address, testHTTPServer_RequestHandler) - print('running server...') + #print('running server...') + # Logging + mGlobalDict["Logger"].info(f"Server init. Listen URL: {inServerAddress}, Listen port: {inPort}") httpd.serve_forever() #Authenticate function () @@ -288,7 +290,7 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler): self.wfile.write(inResponseDict["Body"]) def do_GET(self): # Prepare result dict - lResponseDict = {"Headers": {}, "SetCookies":{}, "Body": "", "StatusCode": None} + lResponseDict = {"Headers": {}, "SetCookies": {}, "Body": "", "StatusCode": None} self.OpenRPAResponseDict = lResponseDict ##################################### #Do authentication @@ -300,6 +302,8 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler): lAuthenticateDict = AuthenticateVerify(self) if not lAuthenticateDict["User"]: lFlagAccessUserBlock=True + # Logging + mGlobalDict["Logger"].info(f"HTTP request /. Domain: {lAuthenticateDict['Domain']}, User: {lAuthenticateDict['User']}") if lFlagAccessUserBlock: AuthenticateBlock(self) ##################################### diff --git a/Sources/pyOpenRPA/Studio/Web/Index.xhtml b/Sources/pyOpenRPA/Studio/Web/Index.xhtml index 218df737..780f81ac 100644 --- a/Sources/pyOpenRPA/Studio/Web/Index.xhtml +++ b/Sources/pyOpenRPA/Studio/Web/Index.xhtml @@ -9,6 +9,115 @@ crossorigin="anonymous">