jesusilvester
Posts: 20
Joined: Fri Jun 26, 2009 12:47 pm

custom log file entries

hi Cosmin ,

We need to enter some custom log entries on every phase of the installation. for example after running dbscript we need to log Database created/ Error

Is there any option available to solve this. Plese help

thanks
Jesukaran John Silvester
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Re: custom log file entries

Hi,

In a VBScript Custom Action, you can simply use the WriteToLog function described in this HowTo article:

Code: Select all

Function WriteToLog(msg)
  Const msiMessageTypeInfo = &H04000000
  Set record = Session.Installer.CreateRecord(1)
  record.StringData(0) = "[1]"
  record.StringData(1) = CStr(msg)
  Session.Message msiMessageTypeInfo, record
End Function
You can invoke it from your code as follows:

Code: Select all

Function YourCAFunction
  WriteToLog("[MY_CA] Message for log.")
End Function
Keep in mind however that your Custom Action must be scheduled in one of sequence tables (InstallUISequence and/or InstallExecuteSequence) - logging will not work from an UI Custom Action.

In a C++ DLL Custom Action use the MsiProcessMessage function.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”