Is there a way to log NSIS actions to a file?
Similar to msiexec /l*v options.
Thx
dB.
NSIS logging
8 posts
nsExec::Exec '"${NSISDIR}\makensis.exe" /OFILE.LOG FILE.nsi'
I think dblock wants to log actions of an installer, not the makensis compiler.
You need to download the Advanced Login build of NSIS from:
See this for LogSet and LogText usage:
-Stu
You need to download the Advanced Login build of NSIS from:
See this for LogSet and LogText usage:
-Stu
You are right, that's more of what I am looking for. But I'd really like an automatic logger enabled through command line like msiexec has. Something that logs all standard actions without me having to add LogText in the code or enable logging for all installations.
With an MSI you can do msiexec /l*v out.log /i installer.msi and you're on.
Thx
dB.
With an MSI you can do msiexec /l*v out.log /i installer.msi and you're on.
Thx
dB.
Another solution (but somewhat less automatic). This solution is similar to LogText (you need to log every line explicitly). I needed logging before INSTDIR gets created. Here's my solution.
First logging happens in TMP, after creating INSTDIR, logfile will be moved and continued there.
First logging happens in TMP, after creating INSTDIR, logfile will be moved and continued there.
You have to call those macros in Functions or Sections:
; logging
Var MY_LOGFILE
!define MY_LOGFILENAME "MyInstall.log"
!macro _logline LINE
; Messagebox MB_OK "logline $MY_LOGFILE ${LINE}"
StrCmp "$MY_LOGFILE" "" +10
Push $R0
Push $R1
StrCpy $R1 "${LINE}"
FileOpen $R0 "$MY_LOGFILE" a
FileSeek $R0 0 END
FileWrite $R0 "$R1$\r$\n"
FileClose $R0
Pop $R1
Pop $R0
!macroend
!macro LogToTmpDir
StrCpy $MY_LOGFILE "$PLUGINSDIR\MyInstall.log"
!macroend
!macro LogToInstDir
IfFileExists "$MY_LOGFILE" 0 +3
StrCmp "$MY_LOGFILE" "$INSTDIR\MyInstall.log" +3
CopyFiles /SILENT "$MY_LOGFILE" "$INSTDIR\MyInstall.log"
StrCpy $MY_LOGFILE "$INSTDIR\MyInstall.log"
!macroend
!macro LogDelete
IfFileExists "$MY_LOGFILE" 0 +2
Delete "$MY_LOGFILE"
StrCpy $MY_LOGFILE ""
!macroend
!define logline `!insertmacro _logline`
Function .onInit
InitPluginsDir
!insertmacro LogToTmpDir
${logline} "log to tmp"
FunctionEnd
Section SecTest
SetOutPath "$INSTDIR"
!insertmacro LogToInstDir
${logline} "log to instdir"
SectionEnd
You can turn Logging on and off using LogSet on/off
You can read command-line parameters using the GetParameters function in the NSIS docs. There are more functions on the archive for getting command-line switches and values etc. A search on there should help you.
-Stu
You can read command-line parameters using the GetParameters function in the NSIS docs. There are more functions on the archive for getting command-line switches and values etc. A search on there should help you.
-Stu
Originally posted by Afrow UKApologies for resurecting and old thread but its better to keep everything in one place for future searchers
I think dblock wants to log actions of an installer, not the makensis compiler.
You need to download the Advanced Login build of NSIS from:
See this for LogSet and LogText usage:
-Stu
The url given above for the Logging build points to an empty Wiki page. Does this build still exist somewhere?
if it does exist how does it work, i.e. do you have to logging commands into the script (e.g. LogThis "My Log Entry") or does NSIS log what it is doing without explicit log commands.
The top page is now at:
As for the second question, check the second link.
-Stu
As for the second question, check the second link.
-Stu