divyaniP
Posts: 16
Joined: Mon Dec 21, 2020 1:15 pm

Custom log file generation for MSI package type

Tue Feb 09, 2021 10:59 am

I want to create a custom log file for MSI package type, where I want to show warning messages to the user regarding entered input from the user.

Also, I referred to this link of "How to write a specific event in the log": https://www.advancedinstaller.com/user- ... ction.html

But here they have mentioned, "Run the installation package with logging enabled". How to enable the logging for MSI files?

Also, the log file contains a lot of information which is not my primary concern. I want to show users only my customized warning messages So that users will get to know that why installation stopped immaturely.
Can we have a way to implement this?

Please help me with this.
Regards!

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

Re: Custom log file generation for MSI package type

Tue Feb 09, 2021 8:41 pm

Hello,
But here they have mentioned, "Run the installation package with logging enabled". How to enable the logging for MSI files?
You can create a log file for your MSI by running the MSI with a command line such as follows:

Code: Select all

msiexec /i <path_to_msi> /L*V <path_to_log_file>\log.txt
Also, the log file contains a lot of information which is not my primary concern. I want to show users only my customized warning messages So that users will get to know that why installation stopped immaturely.
Above I have given an example creating a verbose log. However, the log file can be more succint. For instance, if you create the log file using a command line as it follows:

Code: Select all

msiexec /i <path_to_msi> /l <path_to_log_file>\log.txt
the log file will be much smaller.

For more information about this, please have a look over our "How do I create an installation log?" article.

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

divyaniP
Posts: 16
Joined: Mon Dec 21, 2020 1:15 pm

Re: Custom log file generation for MSI package type

Thu Feb 11, 2021 4:24 am

Is there any way to update our custom warning messages in a file during installation?

We want to dump error messages in a file So that if the installation fails immaturely, the user can check for error messages in that file. (We don't pop up warning dialog during installation)

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

Re: Custom log file generation for MSI package type

Fri Feb 12, 2021 4:08 pm

Hello Divyani,

Sure thing.

Now, it depends how you have stored the custom warning messages in your installation.

For instance, if you have stored them as installer properties, you can use a "Text file update" to write them to a .txt file. Here's a step-by-step which you can follow in order to achieve that:

- an empty .txt file

- add the above file in "Files and Folders" page

- e.g. of property that stores the message:
Error.png
Error.png (81.49KiB)Viewed 3627 times

- e.g. of "Text file update":
AppendError.png
AppendError.png (241.43KiB)Viewed 3627 times

Hope this helps!

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

divyaniP
Posts: 16
Joined: Mon Dec 21, 2020 1:15 pm

Re: Custom log file generation for MSI package type

Mon Feb 15, 2021 5:44 am

Yes, I have stored them as installer properties. Also, I have used a "Text file update" to write them to a .txt file. But this file creates only when the installation works fine. If the installer stops prematurely then the file isn't created.

We want a log file that will be created during successful installation as well as in failure. If an error occurs during installation then the user can review that log file and check those custom warning messages which we have given.

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

Re: Custom log file generation for MSI package type

Wed Feb 17, 2021 2:29 pm

Hello Divyani,

You are indeed, right - the .TXT file will only be created if the installation is successful.

With this in mind, I'm afraid we can not really achieve this with our predefined support, since a "Text file update" operation is executed either on a component install or uninstall, therefore if the setup fails before that, it will not be executed.

You can create a .TXT file through the custom action and then write your custom messages to it (for instance, a PowerShell script).

For instance, if you want to retrieve the value of a property in your PowerShell script, you can proceed as it follows:

Code: Select all

$custom_message_1 = AI_GetMsiProperty THE_PROPERTY_THAT_STORES_YOUR_MESSAGE
More information about this can be found in our "How to set an installer property using custom actions" article.

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

Return to “Building Installers”