logging from custom action to log file

  • Thread starter Thread starter melanie
  • Start date Start date
M

melanie

Hi,

I've got the following problem:

I use several custom actions (all are in a DLL file stored in a Binary table
stream, all Immediate Execution). I use a MSIHANDLE and MsiProcessMessage
with INSTALLMESSAGE_INFO to log to the windows installer log file.

When I schedule the custom action in the ExecuteSequence or in the
UISequence erverything works fine. But when the custom action is triggered
by a control event fired by a dialog (so in UISequence too), no log file
enties are done. But for me it would be quite helpful to have these
loggings.

Is it in general impossible to log from custom actions triggered by events?
Or does anybody have a solution?

Thanks in advance
Melanie
 
Hello Melanie,

MsiProcessMessage does not work so well when the custom action trying to use
it is launched by DoAction event.

Check out:
http://msdn.microsoft.com/library/en-us/msi/setup/returning_error_messages_from_custom_actions.asp

"Note that custom actions launched by a DoAction ControlEvent can send
messages with the Message method but cannot send a message with
MsiProcessMessage. On systems earlier than the Windows Server 2003 family,
custom actions launched by a DoAction ControlEvent cannot send messages with
MsiProcessMessage or Message method."

If you are really desperate for this information you could always write to
your own log file or save some text in a property and have another
non-DoAction launched CA (one scheduled directly from UISequence) write it
to the log for you.

Sincerely,
Adrian Accinelli
 
I was desperate for logging in the UI during DoAction events so before
the dialog sequence started, I used an asynchronous
CA to create a COM apartment and store an object in the Running Object
Table. This object would cache messages in memory, only to later flush
them out to the log file after an Event object was signaled when the
dialog sequence was over.

During the DoAction events I would reference my logging object out of
the ROT and log when needed. When I needed to shut down the logger, I
would signal an event, causing the asynchronous CA that installed the
logger into the ROT to remove it, clean up, log all of the messages and
return.

Note: Make sure that the event to shut down this logger gets signaled
so the async CA can return, otherwise the UI will hang.
 
Back
Top