Archive: Logging, Error handling, Stop Services?


Logging, Error handling, Stop Services?
Hello,

i would like to add more features to the install script. three questions:

1.) How to record a log to a file from doing so much copy files, install applications?
i found a function called 'page', but first 'logset' needs to be 'on'. 'logtext' needs to be use.



2.) how to i tell the script to stop mysql service temporary, to delete a mysql log file?


3.) How do i use the errorhanding functions, there appeares to only be a few of them from NSIS.

Asch


1) To get nsis to log it's activity you need to recompile with logging enabled, many people are not capable of recompiling NSIS because they do not have VC++6 or VC.NET. Of course you could just write to a file using NSIS file writing commands yourself.

2) Either use my services plugin from the Archive downloads page or issue the command "net stop servicename".

3) Error handling consists of checking IfErrors, nothing more (that I am aware of). More complex handling can be achieved by setting more specific flags (variables) yourself and checking them at a convenient place in the script.


Re: Logging, Error handling, Stop services!
Hello,
I have been reading other threads about logging, there seems to be difficulties in logging with NSIS. There are solutions for other users' problems. For better logging, one must recompile NSIS, which is fine.
In Win XP pro, from the Dos prompt type:

cl

i usually type:

cl /G4 or /G5 name.cpp

this is the Window build in c/c++ compiler/linker. If on one knows about this, Now you know. its a nice feature.

this might work for others if they have Win XP pro.

Also, Borland has a Free GUN version of C++, with GUEE interface just like the MS-VS-C++

Back to my problem:
1.)I needed basic logging, so once i set 'Logset on',i should be able to use 'logtext'.
May i have an example from logtext with all the perammeters.

2.) how do i stop service Mysql service using 'WriteRegStr HKLM' one of these build in NSIS variables?

example please.

3.) i guess i have do little error handling after all, since there are no more than that function code.

I will put the codes online if anyone needed. After Help is given to me.

Sincerely,

Asch


1) I don't think compilers other than VC++6 and possibly VC.NET are supported by us (NSIS developers), good luck if you can get it working on another compiler and please pass on any info about how you got it to work pretty please :)

As the documentation indicates LogText only has one parameter. You say LogText text. Anything in the text parameter is logged to the log file. It's that simple.

Full information can be found in Section 3.8.12 of the NSIS docs.

2) Exec "net stop mysql"

3) You might want to use IfErrors to ensure that all of your files copied correctly etc.


Logging, error handling, stop services!
Hello sunjammer,

sure i will try compiling NSIS App using my win build in compiler in XP pro today.
Tell me where is the head and tails of this NSIS software, Where is the "main()" function and exactly where it is?


i don't have Borland's C++ GNU compiler.
its only 11 MB to download.

Another question, how do i stop a CMF software from the open source community call Zope from zope.org. this thing is weird, everything is written in python, no EXE files anywhere in this running application.

Can i stop zope withone of these HKLM variables? if i could find the register zope key. to tell it to stop service.

Asch


I know absolutely nothing about Zope, sorry. You can stop the Zope server if it is an installed service (appears in Control Panel->Administrative Tools->Services) using the "net stop servicename" syntax I mentioned above.

I think you will have trouble compiling NSIS with another compiler like Borland, good luck. What is this "win build in" compiler you refer to? There isn't a built-in compiler in XP or XP pro AFAIK!

Why do you want to know where main() is? To compile the code you don't need to understand it. The main function for makensis.exe is in source\makenssi.cpp. The mai) function for the header attached to the installer created by makensis.exe is in source\exehead\Main.c (called WinMain, not main).


hello,

is it possbible for someone to compile a new version of NSIS 2.0b1 with the LOGGING enable and post it here or somewhere.
After reading more of the other users' experience, i realized that LOGGING-> LOGTEXT is not build in to this version.
i fear to compile the source of 2.0b1 with XP build in compiler/linker will have problems.


Sincerely,

Asch


Sunjammer (and anyone else who is scratching their heads over this "builtin MS C/C++ compiler issue),

The deal here is that [possibly starting in 2003] the ".NET Framework SDK" free download from MS *includes* the command-line version of the VC7 compiler - but NO GUI. Really. :)


#@!£ing hell !! I'm suprised they did that !


While I am sure it's all part of some nefarious MS plot, you might check out:

http://www.icsharpcode.net/OpenSource/SD/Default.aspx

for some related info - note that they are also users of NSIS, which is how they came to my attention.


re: Logging and c/c++ compiler from MS
Hello,

i made a mistake, there is no C/C++ compiler that comes with WIN XP pro. I was mistaken about due to that i install MS-VS-6.0 to this laptop and in the DOS batch "autoexec.bat" durinng installation of this software, VS6.0-C++ made a extension to my pathing statement %PATH% which added the actual compiler/linker if you use the dos interface.

So i now can access the graphical compiler VS6.0-C++ in a DOS prompt.

Sorry about that.

Still, anyone compiled a copy with Logging enable, i can't seem to compile the source, there were lots of *.obj Errors during compilation process.


Asch


Compile using Release instead of Debug. If you have the latest Platform SDK there shouldn't be any problems.


hello,

i have recompiled this application with the logging avability enable.

I don't know if i should put it on this forum, if anyone want to use this recompile software with source codes.

it is about 2.8 Meg of stuff!!!
If any of the forum Moderator would like to have a copy. Email me too. i will sent it to you.

Email me @ aschenbach0@lycos.com

Asch


only the exe is needed, that's nowhere near 2.8mb of course


Still having problem with Logging.
Hello sunjammer,

after zipped up the makensis.exe file, its small enough to ship it anywhere.

i am still having problem as to how to log stuff in the codes.

here is a sample.

;works in run time
function "creatdir"
; need to log all copyig and creating dirs
LogSet on
strcpy $INSTDIR "C:\"
copyfiles "c:\temp\*.*" "c:\"
createdirectory "C:\temp\copy"
LogText "Dirs created"
setoutpath "$INSTDIR\temp"
file "C:\temp\erraten.log"
functionend

Alright, i want to suck in a file name erraten.log. i assume the syntax for Logtext is just like on the above.

i needed to output to that file "dir created" and all the files that got transfer from c:\temp to c:\ in that log file.

Is that right (syntax wise)?
it won't log?

Asch


You'll need to update to the latest CVS version for LogSet on to work.


Hello,

well, just might forget about logging completely. Can you point me to get the proper files put it where in directories.
i guess i have to recompile the source all over again.

:-(

Asch


You can use NSIS Update to get the latest files. I am sorry I forgot to mention this earlier.