electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.51k stars 1.73k forks source link

How to customize the log output file location #8313

Open KyleRicardo opened 3 weeks ago

KyleRicardo commented 3 weeks ago

Hi community,

I need to log the NSIS install and uninstall process, so I change the electron-builder.json5 file to

{
  "nsis": {
    "customNsisBinary": {
      "url": null,
      "debugLogging": true
    }
  }
}

as per https://github.com/electron-userland/electron-builder/issues/5119#issuecomment-889608933 and https://www.electron.build/configuration/nsis

customNsisBinary module:app-builder-lib/out/targets/nsis/nsisOptions.CustomNsisBinary | “undefined” - Allows you to provide your own makensis, such as one with support for debug logging via LogSet and LogText. (Logging also requires option debugLogging = true)

But it seems the output log file's location cannot be customized, the installation log is put under "C:\" and the uninstallation log is put under $INSTDIR

BTW I use /allsuers /S args to do slient installation.

That's very weird, because the $INSTDIR itself should be removed too in the uninstallation process.

Anyone can help on this? I want to customize the log output file location. Many thanks!

mmaietta commented 3 weeks ago

This is where the output path is being set: https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/nsis/common.nsh#L137

I'm not familiar enough with nsis scripting to advise where/what to change in order for the output location to be changed though. Fully in favor of having it in a different location, especially since the uninstallation logs I assume are getting deleted during the uninstall process since it's located in the $INSTDIR