claudenoel
Posts: 17
Joined: Mon Oct 22, 2018 1:25 pm

Log string not recorded from C# Custom Action

Mon Nov 12, 2018 6:39 pm

I created a C# custom action which works fine. However, I want to record some data in the log file. I tried 2 methods:

session.Log("What I want to show in the log file");

session.Message(InstallMessage.Info, new Record { FormatString = "What I want to show in the log file" });

None of these work. I can see my C# function called from the log file but not my string. What am I doing wrong?

Even session.Message(InstallMessage.Warning, new Record { FormatString = "What I want to show in the log file" }); is not working.

Catalin
Posts: 6543
Joined: Wed Jun 13, 2018 7:49 am

Re: Log string not recorded from C# Custom Action

Tue Nov 13, 2018 9:16 am

Hello Claude,

Is you custom action added as a custom action without sequence (triggered from an UI control)? If that is the case, please keep in mind that the "session.Log" method does not log anything when triggered from an UI control (dialog control).

With that being said, if you want to write a specific event into a log file, all you have to do is to add your C# custom action with sequence.

Hope this helps.

Kind regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

claudenoel
Posts: 17
Joined: Mon Oct 22, 2018 1:25 pm

Re: Log string not recorded from C# Custom Action

Tue Nov 13, 2018 2:22 pm

Oh thanks. Yes it was without sequence for testing purposes. It works fine when used with sequence. :)

Catalin
Posts: 6543
Joined: Wed Jun 13, 2018 7:49 am

Re: Log string not recorded from C# Custom Action

Wed Nov 14, 2018 12:14 pm

You're always welcome, Claude.

I am glad you got this working.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”