Old 13th February 2005, 08:22   #1
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
Changing the location of install.log

Hi. I'm using the special build with logging enabled to compile my script. All is ok except the fact that everytime the install.log file is created in the $INSTDIR. Is it possible to change that location? I want the install.log to be created in a specific folder that I will create.
I've tried
SetOutPath "$INSTDIR\$backupFolder"
Rename "$INSTDIR\install.log" '$INSTDIR\$backupFolder\install.log'
but it doesn't work.
Also is it possible to change the name of the file? I want it to be MyFile.log.
Chilli24 is offline   Reply With Quote
Old 13th February 2005, 12:22   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
While your installer is running, the log file will obviously be locked for writing. This is why Rename isn't working. Just use
Rename /REBOOTOK "$INSTDIR\install.log" "$INSTDIR\$backupFolder\install.log"
so that it's moved on restart.

Also, are you using a variable $backupFolder to store the backup folder name? Does the user have the option to change that folder name, or does it stay the same throughout the script.
If it stays the same, then you'd be waisting memory on run-time. Not that it matters much, but it's good practice for programs to use as little memory on run-time as possible.
You should use a !define backupFolder "Backup". Then use ${backupFolder} in your script.

-Stu
Afrow UK is offline   Reply With Quote
Old 13th February 2005, 12:36   #3
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
I don't yhink that the log file is locked for writing because previous to that command I inserted LogSet off. So the install.log file should be free to handle now. Also to move the file after reboot doesn't help me. Because if the isntaller runs twice before reboot, all the actions are logged in the same install.log file. That's why I don't want to use /REBOOTOK. So taking into consideration that LogSet is off, how can I :
- rename the file install.log to, let's say MyProgram.log
- how can I moved it into a folder without rebooting?
P.S. Thanks hor the hint with $backupFolder
Chilli24 is offline   Reply With Quote
Old 13th February 2005, 14:14   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
How about making a test script which has LogSet on, then off, and then display a MessageBox (just to pause install).
Then you could try and delete install.log to see if it's still locked or not.

-Stu
Afrow UK is offline   Reply With Quote
Old 15th February 2005, 17:39   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The log file is only closed when the installer closes.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th February 2005, 06:10   #6
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
OK. But how can I tell the installer to put the log file in another location, different form $INSTDIR like it is by default ?
Chilli24 is offline   Reply With Quote
Old 16th February 2005, 06:13   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You can't without changing the source.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th February 2005, 06:33   #8
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
Ok. Thanks.
Chilli24 is offline   Reply With Quote
Old 9th February 2006, 16:55   #9
mr.hanky
Junior Member
 
Join Date: Feb 2006
Posts: 2
Here is the last thing I do.

CopyFiles /silent "$INSTDIR\install.log" "${MYLOGDIR}\N-2.log"
Delete /REBOOTOK "$INSTDIR\install.log"


*** EDIT ***
Just noticed how old this was.
mr.hanky is offline   Reply With Quote
Old 20th September 2012, 08:59   #10
mtconleyuk
Junior Member
 
Join Date: Nov 2005
Posts: 38
Quote:
Originally Posted by kichik View Post
The log file is only closed when the installer closes.
Is this really true? From the 2.46 code, it looks like handling of a LogSet Off will cause ExecuteEntry() to call log_write(1), which will call CloseHandle(fp) and set <fp> to INVALID_HANDLE_VALUE. That seems as though it should close the file. Is this not right?
mtconleyuk is offline   Reply With Quote
Old 20th September 2012, 09:24   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You are right. They probably changed it at some point. After LogSet off, the handle is closed and the file can be renamed even with the installer still running.

Stu
Afrow UK is offline   Reply With Quote
Old 20th September 2012, 15:31   #12
mtconleyuk
Junior Member
 
Join Date: Nov 2005
Posts: 38
Is there some condition under which LogSet On would fail to open the file in the specified location? I have code that looks basically like the following:

LogSet Off
Push $INSTDIR
StrCpy $INSTDIR "$myLogDir"
LogSet On
LogText "Hi there."
Pop $INSTDIR

and on some occasions this will wind up writing the install.log file into the original $INSTDIR folder, not the one I specified! I've stared at the source code, but I can't see any reason why this would happen.

One possible clue is that when this happens, the installer is running with elevated permissions, using UAC::RunElevated. Again, though, I don't see why this should be a problem.

Any thoughts?
mtconleyuk is offline   Reply With Quote
Old 20th September 2012, 16:21   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Once you have used LogSet the path is now set for the log. Your LogSet off needs to be removed.

Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump