Archive: Log Details


Log Details
I'm using a TextLog.nsh that provides some functions to log text to a file, but I would also like all the output from the instfiles page(or in my case MUI_PAGE_INSTFILES) logged to a file as well. Or if it is silent, log what would be shown in the instfiles page if such a page had been displayed.

Is there a way to access that data through the script?


Can you not use the logging special build?

Stu


Originally posted by Afrow UK
Can you not use the logging special build?
No... which would mean "I can't not"? I know not if I can't, as I have not tried :D I see now the Advanced Logging download in Special Builds. I will check that out, thanks.

Just now in searching the manual for more info on that build, I also saw this:
D.4 Dump Content of Log Window to File
http://nsis.sourceforge.net/Docs/AppendixD.html#D.4

Does anyone know off the top of their head if that script would work on a silent install? I would guess no but just curious. I can't read scripts that have system calls in them, I haven't wrapped my head around the syntax yet.

You can make a simple test to check it out, but I'll save you the trouble because you've asked nicely and say it doesn't work with silent installations.


The advanced logging build is awsome, with exception of one problem.

I can't seem to get it to change the location of the log file. I understand it goes to $INSTDIR\installer.log, so in .oninit I backup the value of $INSTDIR, then set $INSTDIR to a subdirectory, create the directory, then turn logging on. Later, after directory selection takes place, I want to turn off logging, move the log file, and start logging again. So I came up with the below code to test this out. Problem is, it continues to log in the original file. Not sure if there is anything I can do about this. I could wait till the very end to move the file manually though.


StrCpy $0 $INSTDIR ;backup value of $INSTDIR
StrCpy $INSTDIR "$INSTDIR\Logs\Installer1"
CreateDirectory "$INSTDIR"
LogSet on
StrCpy $INSTDIR $0 ;restore original value of INSTDIR
LogText "Here is a bunch of text logged via LogText to the first location: ${__LINE__}"
DetailPrint "Here is a bunch of text logged via DetailPrint: ${__LINE__}"
LogSet off
StrCpy $0 $INSTDIR ;backup value of $INSTDIR
StrCpy $INSTDIR "$INSTDIR\Logs\Installer2"
CreateDirectory "$INSTDIR"
LogSet on
LogText "Here is a bunch of text while logging is in the second location: ${__LINE__}"
LogSet off