[FIX] setup: logline config saved in OS environment config file

To reproduce:
 1. on your windows computer, add a system environment variable with:
  - Key: ODOO_RC
  - Value: (path to any file except the `$INSTDIR\server\odoo.log`)
 2. Install Odoo Windows version
 Notice that the log are stored into the `$INSTDIR\server\odoo.log` file
 3. Restart Odoo's service
=> Odoo's log file does not log anything anymore

Cause:
As odoo will use in priority the environment variable as the config file path.
This will save the config change into that file instead of the intended one at
`$INSTDIR\server\odoo.conf`.
Due to this, the config file remain the default one created by the previous commands
but the log_file information get save to the wrong config file.
On restart of the service, as the parameter is not present,
it does not log in the intended way

After this commit:
 Logs are logged into the log file as intended

Was discovered accidentally while reviewing an IoT PR:
https://github.com/odoo/odoo/pull/137547

closes odoo/odoo#142796

X-original-commit: bbd06814a7e42c22206087c0df1e06d14dbba74e
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Loan Sens (lse) <lse@odoo.com>
This commit is contained in:
Loan (LSE)
2023-11-21 20:06:49 +00:00
parent e7f3a78abe
commit bb7bbb80ac
+1 -1
View File
@@ -255,7 +255,7 @@ Section $(TITLE_Odoo_Server) SectionOdoo_Server
# Productivity Apps
WriteIniStr "$INSTDIR\server\odoo.conf" "options" "default_productivity_apps" "True"
DetailPrint "Installing Windows service"
nsExec::ExecTOLog '"$INSTDIR\python\python.exe" "$INSTDIR\server\odoo-bin" --stop-after-init --logfile "$INSTDIR\server\odoo.log" -s'
nsExec::ExecTOLog '"$INSTDIR\python\python.exe" "$INSTDIR\server\odoo-bin" --stop-after-init -c "$INSTDIR\server\odoo.conf" --logfile "$INSTDIR\server\odoo.log" -s'
nsExec::ExecToLog '"$INSTDIR\nssm\win64\nssm.exe" install ${SERVICENAME} "$INSTDIR\python\python.exe"'
nsExec::ExecToLog '"$INSTDIR\nssm\win64\nssm.exe" set ${SERVICENAME} AppDirectory "$\"$INSTDIR\python$\""'
nsExec::ExecToLog '"$INSTDIR\nssm\win64\nssm.exe" set ${SERVICENAME} AppParameters "\"$INSTDIR\server\odoo-bin\" -c "\"$INSTDIR\server\odoo.conf\"'