cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
fishyj
Level 3

Logging from inside Managed Custom Actions.

Hello,

I'm trying to add logging to my managed (C#) custom actions.

The log reports that the custom action is called. But nothing is logged from inside the managed code.

I created a small function to illustrate...


public void TestLogging(int handle, string msg)
{
using (Msi.Install install = Msi.CustomActionHandle(handle))
{
Msi.Record record = new Msi.Record(1);

//record.SetString(0, msg);
record.SetString(0, "Hello World...!");;

install.ProcessMessage(Msi.InstallMessage.Info, record);
}
}


A snippet from the log is shown below.

MSI (c) (98:B0) [14:26:38:656]: Doing action: TestLogging
Action 14:26:38: TestLogging.
Action start 14:26:38: TestLogging.
MSI (c) (98:1C) [14:26:38:665]: Invoking remote custom action. DLL: C:\Users\JASON~1.HAU\AppData\Local\Temp\MSIC2E4.tmp, Entrypoint: m2
Action ended 14:26:39: TestLogging. Return value 1.

Any ideas why my message does not appear?
Labels (1)
0 Kudos
(4) Replies
fishyj
Level 3

Unless I'm missing something, Managed actions don't fit well with Installshield.:mad:

The suggested work-around, changing a property in the managed custom action in order for the change in value to be logged, does not work for me.....

What am I doing wrong?????
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

How are you generating your log - namely are you specifying v of /l*v (or of voicewarmup, depending on context)? I believe only verbose logs contain property change information.
0 Kudos
Christopher_Pai
Level 16

Logging from managed c# custom actions is easy:

session.Log("Hello World");

You just have to be using the right tools. The tool I'm thinking of is completely compatible with Windows Installer and therefore InstallShield. I don't care who made the tool.... I only care about efficiently making bulletproof installers.
0 Kudos