2
votes

I have application with Inno Setup installer. Application is running on background. This means, when I upgrade application (installing new version over old one), I need installer to close this application, so all files might be replaced gracefully.

But it seems, that sometimes it fails to close application for some unknown reason. To get reason, I'd like to log it. The problem is, that since installer can't replace files, user gets error message, which stops installer from finishing. And Inno Setup writes log only after successfully finishing installation.

The actual question is - is last statement correct, or is there a way to configure Inno Setup installer, so it will create log file even on aborted installation? I have idea to make my very own manual log file, which will be created on installation start, and updated every time some method is executed, but I don't want to reinvent wheel.

1

1 Answers

2
votes

And Inno Setup writes log only after successfully finishing installation.

No that's not correct.

The log is started as soon as the installer starts, even before it eventually fails.

So there's some log always (if enabled), no matter what.

The moment the installer window opens, the log already looks like:

2016-05-13 12:30:45.712   Log opened. (Time zone: UTC+02:00)
2016-05-13 12:30:45.712   Setup version: Inno Setup version 5.5.9 (u)
2016-05-13 12:30:45.712   Original Setup EXE: C:\path\mysetup.exe
2016-05-13 12:30:45.712   Setup command line: /SL5="$C0338,134364,121344,C:\path\mysetup.exe" /SPAWNWND=$200C5A /NOTIFYWND=$110C08 /log=install.log
2016-05-13 12:30:45.712   Windows version: 10.0.10586  (NT platform: Yes)
2016-05-13 12:30:45.712   64-bit Windows: Yes
2016-05-13 12:30:45.712   Processor architecture: x64
2016-05-13 12:30:45.712   User privileges: Administrative
2016-05-13 12:30:45.712   64-bit install mode: No
2016-05-13 12:30:45.712   Created temporary directory: C:\Users\martin\AppData\Local\Temp\is-K3VS6.tmp

The log is created only if:

  • you ask for it using /log=c:\path\setup.log switch (as you can see in my log above) or
  • the log is forced using the SetupLogging=yes directive, in which case, the log is created in %TEMP%\Setup Log yyyy-mm-dd #xxx.txt.