Log files

Got a problem you cannot solve? Try here.
Post Reply
skolte
Posts: 2
Joined: Wed Jul 20, 2011 1:19 pm

Log files

Post by skolte »

I referred to 'Logged execution' in documentation and also a few posts on this forum regarding logging information. I am still not sure if I am doing it correctly and just need someone to verify my approach.
I declared a variable LOGFILE with the location of log file, then after each important step such as checking pre-requisites, updating config etc I added a statement setting LOGGED variable, and then wrote that to LOGFILE as shown in the code below. Is this approach correct to log information as your installer runs or is there a better way? I read that we need to use <setup.exe> /l= path to log file. Where exactly do we provide these arguments? On command line?

When I do try something like the code below, it does create a file but when it hits 'Apply Install', it hangs. If I simply write the content of '$LOGGED$' to log.txt after 'Apply Install', log.txt gets created but remains empty. Any ideas?

Code: Select all

Set Variable LOGFILE to $TARGETDIR$\log.txt
.
.
.
Set Variable LOGGED as 'Running pre-requisite checks'
Write into Text File $LOGFILE$ from Value $LOGGED$ (at end of file)
.
.
.
Set Variable LOGGED to "Updating Config files"
Write into Text File $LOGFILE$ from Value $LOGGED$ (at end of file)
.
.
.
Set Variable LOGGED to "SERVERADDRESS = " SERVERADDRESS
Write into Text File $LOGFILE$ from Value $LOGGED$ (at end of file)
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: Log files

Post by giaviv »

That's definitely a way to do it.

Also, you can use the LOGGED pre-defined variable:

Code: Select all

LOGGED: Initially set to the full path for the log file requested in the command line. If an empty string, indicates no logging has been requested at the command line. Set to a valid path name to enable logging from script. 
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
skolte
Posts: 2
Joined: Wed Jul 20, 2011 1:19 pm

Re: Log files - logging programmatically

Post by skolte »

Ok, thanks.

In your documentation in 'Logged Execution' chapter, it would have been really helpful if you would have simply given an example.
In that chapter, just below the text where it says

<setup.exe> /l=<path to logFile>

you might want to add
To enable logging programmatically, after you have called 'Apply Install' command, use the following command:

Code: Select all

Set Variable LOGGED to $TARGETDIR$\log.txt
This is just in case someone else is trying to figure out how to enable logging programmatically.

Thanks
Post Reply