Add a log level replacement for nlog.config

This commit is contained in:
Evgeniy Antonyuk 2023-07-27 15:12:25 +05:00
parent f2c4ddfe9f
commit ef99b47510

View File

@ -240,5 +240,12 @@ jsonData["Redis"].update(REDIS_USER_NAME) if REDIS_USER_NAME is not None else No
jsonData["Redis"].update(REDIS_PASSWORD) if REDIS_PASSWORD is not None else None
writeJsonFile(filePath, jsonData)
filePath = "/app/onlyoffice/config/nlog.config"
with open(filePath, 'r') as f:
configData = f.read()
configData = re.sub(r'(minlevel=")(\w+)(")', '\\1' + LOG_LEVEL + '\\3', configData)
with open(filePath, 'w') as f:
f.write(configData)
run = RunServices(SERVICE_PORT, PATH_TO_CONF)
run.RunService(RUN_FILE, ENV_EXTENSION, LOG_FILE)