Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Writing to the log file


4 replies to this topic

anthonyh

anthonyh
  • Full Members
  • 93 posts

Posted 05 March 2002 - 19:23

Is there a way that I can write to the msi log file from a custom action, or do I need to create my own? The custom action calls an API in a dll.



Thanks,
Anthony
Product Availability Developer
Avantis
Invensys Process Systems

Using InstallShield Developer 7.04 - Basic Project

Tarala

Tarala
  • Members
  • 1 posts

Posted 05 March 2002 - 23:52

You can use SprintfMsiLog

KiwiGeek

KiwiGeek
  • Members
  • 19 posts

Posted 06 March 2002 - 05:02

I use MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hMessageRecord).
Create hMessageRecord using MsiCreateRecord, and set field 0 to the text you want in your message. If you want to make it display Installer propertes, just use the standard [property] syntax. Also, [1] takes the value in field 1, etc.
Jamie
The geek shall inherit the earth

anthonyh

anthonyh
  • Full Members
  • 93 posts

Posted 06 March 2002 - 16:26

For MsiCreateRecord(), what do I pass in as the parameter, 1?



Thanks.
Product Availability Developer
Avantis
Invensys Process Systems

Using InstallShield Developer 7.04 - Basic Project

KiwiGeek

KiwiGeek
  • Members
  • 19 posts

Posted 12 March 2002 - 02:35

The parameter you pass in to MsiCreateRecord is the number of extra bits of information you want displayed in your message. The following example will make a log file line with 2 parameters.
Code Sample
UINT Function1(MSIHANDLE hInstall) {
PMSIHANDLE hMessage = MsiCreateRecord(2);
MsiRecordSetString(hMessage, 0, "Field 1 is '[1]'; Field 2 is '[2]'");
MsiRecordSetString(hMessage, 1, "I am field 1!");
MsiRecordSetInteger(hMessage, 2, 1234);
MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hMessage);
}


This will create the following line in the log file:
Code Sample
Field 1 is 'I am field 1!'; Field 2 is '1234'


You can also use MsiCreateRecord(0) to create a log line with no extra parameters. Eg:
Code Sample
UINT Function2(MSIHANDLE hInstall) {
PMSIHANDLE hMessage = MsiCreateRecord(0);
MsiRecordSetString(hMessage, 0, "Starting installation of [ProductName] [ProductVersion]");
MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hMessage);
}

Jamie
The geek shall inherit the earth