Archive: LogSet turns itself Off...


LogSet turns itself Off...
I'm updating my installer (with 2.05) with some new features, and one of the things I did was move the "LogSet On" command from my first section to the .onInit function, for more complete logging. Now I’m getting logging from the very beginning of the install which is nice. However, I found a problem.

When I run my installer in silent mode, I get 100% of the logging. However when I run it in normal (MUI) mode, the logging stops right after my DirectoryLeave function. The next page in my installer is the MUI_PAGE_INSTFILES, so I just added the "LogSet On" command (for the second time) to the first line of the first section, and it continues on.

Its like my DirectoryLeave function or the INSTFILES page turns off the LogSet setting. Any thoughts?

Thanks.


I created a sample nsi file that this problem is reproducible in. Compile the below code and run it by double clicking on it. After it runs (on you desktop is fine) you will see that the log file stops logging right after the directory leave function. Then run it in silent mode from command line, (logset.exe /S) and you will see the logging keeps going throughout the sections.

If you then un-comment the ;LogSet On command in the -Pre section, that seems to correct the problem, but having to set LogSet twice (in .onInit and in the first section) seems like a bug. Thanks all.



; NSIS 2.05

!define PRODUCT_NAME "LogSet"
!include "MUI.nsh"
!define MUI_ABORTWARNING

; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "DirectoryLeave"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"

; MUI end------
Name "${PRODUCT_NAME}"
AllowRootDirInstall True
OutFile "LogSet.exe"
InstallDir "$EXEDIR"
ShowInstDetails Hide


Section "-Pre"
;LogSet On
IfSilent 0 End
Call DirectoryLeave
End:
SectionEnd


Section "1" SEC01
DetailPrint "In Section 1"
SectionEnd


Section "2" SEC02
DetailPrint "In Section 2"
SectionEnd


Section "3" SEC03
DetailPrint "In Section 3"
SectionEnd



;---------------------------------



Function .onInit
LogSet On
LogText ""
LogText ""
LogText "_________________________"
LogText "Start of ${PRODUCT_NAME}"
FunctionEnd

Function DirectoryLeave
DetailPrint "In DirectoryLeave"
FunctionEnd

The directory page can turn the logging on and off. If the user holds the shift key when moving into the directory page, he sees a checkbox asking him if he'd like to turn logging on. I guess the leave code doesn't check if shift was held and checks the checkbox anyway. When there is no checkbox, it turns off logging because the "checkbox" is not checked. Please submit a bug report in the bug tracker.


Thanks kichik. Will do, just going to get lunch first, thanks again!


Bugged in bug tracker, thanks!