Log file location - Advanced Installer Community
rmugione7
Posts: 16
Joined: Wed Oct 16, 2019 5:38 pm

Log file location

Hello to eveyone.

I have serious problems to understand the msi logging system.
It’s important for me to have a secure and common place where to write the installation log files. This location must be easy as possible to be found by an unexperienced customer.
Our installation is hidden (silent and run by a service with no gui interaction). Therefor the logging system is very important.

I’ve chosen the ProgramData forder ... yes I know it’s a hidden folder and not that easy to find.
Is there a better folder to use?

Every Prerequisites that I install is launched with this arg: /l+* “[CommonAppDataFolder][Manufacturer]\Logs\ThePack.log”
And the MSI command line is: /l+* “[CommonAppDataFolder][Manufacturer]\Logs\ThePack.log”

This doesn’t work for two reasons:
1) Some times [CommonAppDataFolder] is empty. This is unexpected (issue?).
2) If the sub folder [Manufacturer]\Logs is missing the MSIEXEC is unable to create the sub folder and an error is shown (issue?).

I’ve tried replacing [CommonAppDataFolder] with %ProgramData% and it’s not resolved as an environment variable, at least not always (other issue?).

I’m unable to understand which variable to use and when.

Are those issues? or I ‘haven’t understood the MSI demoniac behavior?
Can you help me?

Thanks
Ricardo
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Log file location

Hello Ricardo and welcome to Advanced Installer forums,
Is there a better folder to use?
Unfortunately, I can not say if there is or is not a better folder to use for the logging. This may differ from user to user. However, the Program Data is a nice folder to place your logs in due to the fact that it's shared between all the accounts.
1) Some times [CommonAppDataFolder] is empty. This is unexpected
Could you please give me some more details here? What do you mean by "some times"? Does this randomly reproduces or it reproduces when several changes are done to the project?
If the sub folder [Manufacturer]\Logs is missing the MSIEXEC is unable to create the sub folder and an error is shown
This is really strange. By default, the %programdata% folder does not have write permissions for regular users. However, the "Administrators" group have write permission and since you are installing the product silently, it's a must to deploy the setup from an elevated command prompt, therefore this should be working.
I’ve tried replacing [CommonAppDataFolder] with %ProgramData% and it’s not resolved as an environment variable, at least not always
The correct syntax for the %programdata% environment variable is: "[%ProgramData]", not "%ProgramData"

Again, I'm not quite sure what you mean by "not always" here.

In order for me to further investigate this issue, could you please forward me the following:

- a copy of the .AIP file

- a download link for the setup which is built with the above mentioned .AIP file (and which reproduces this behavior)

- a test case which I can follow in order to reproduce the behavior

by e-mail at support at advancedinstaller dot com?

Looking forward to hearing from you.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rmugione7
Posts: 16
Joined: Wed Oct 16, 2019 5:38 pm

Re: Log file location

Hello Catalin,
Thanks for your sugestions. I tried them but it's still not working as I expected.

Our service runs under SYSTEM user, therefore as Administrator.
Running the package with a doubble click it will be elevated to Admin.
Hidden install or not the logs are not always written.
and ---> If I set the path using absolute path C:\ProgramData\<filenme> it works fine and I get all log files. <----
It's not a access denied problem.

When I say 'not always' and 'some times' I mean that it's not clear whats happening.
I don't get the log file where I wrote.

There is no doubts that a bug exists. MSI is not able to create the sub folder ..... see the --> tests for the demonstration

These are the details you requested:

Try with a blank package using the following tests. (i'm using AI ver 15.5.1 and 16.4.1, same thing)
I'm running the test package outside AI because I noticed different behaviour (it's not clear)
Try it outside of AI.

TESTS:

1) Under Bootstrapper Options the "MSI command line"

Setting it to /l*+ "[%ProgramData]\TestCompany\Logs\TestPackage.log"
I get an error message "Error opening installation log file......"

Setting it to /l*+ "[%ProgramData]\TestPackage.log"
I get an error message "Error opening installation log file......"

Setting it to /l*+ "[%ProgramData]TestPackage.log"
A log file is created side by side the package and named "[%ProgramData]TestPackage.log". The package is installed.
The environment variable is not expanded

Setting it to /l*+ "C:\ProgramData\TestCompany\Logs\TestPackage.log"
----> I get the log file ONLY IF the sub folder TestCompany\Logs exists, otherwise i get the error message "Error opening installation log file......" <----

Setting it to /l*+ "C:\ProgramData\TestPackage.log"
----> I get the log file and the package is installed <----


2) Add a Prerequisite ..... an other project PrePack2.exe
Set the Install Command Lines to add a log file usign the above cases.

I get differet behavior, depending on where the package is under Pre-install, Feature-based or Post-install.
Also, differet behavior in case I use [%ProgramData] or [CommonAppDataFolder].
Some times it works, other I don't get any file. I've searched the file under the hole disk.

Thankyou
Ricardo
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Log file location

Hi Ricardo,

Thank you for the detailed description. Much appreciated.

1) Indeed after further investigating on this it seems the "MSI command line" field does not support formatted references of environment variables (e.g. [%ProgramData]). This seems to be a limitation of our tool and we will try to address it in the future. Thank you for bringing this to our attention.

To get this always working please use a command line like this:

Code: Select all

/l*+ "[CommonAppDataFolder]\TestPackage.log"
i.e. by using a folder property formatted reference.

Also, as a side note, when the folder when you try to create the log does not exist the installation fails with the "Error opening installation log file..." error message. This is the normal behavior and it happens because the Windows Installer service does not create by default the missing folder when does not exist.

2) The formatted references are supported by the command line fields of the prerequisite items only if the prerequisites are feature-based or post-install. The pre-install prerequisites does not support them.

To get the prerequisites logging always working I would recommend you to use a command line like this:

Code: Select all

/l*+ "%programdata%\TestPackage.log"
i.e. by using the standard reference of a Windows environment variable.

Let us know if this still does not work.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rmugione7
Posts: 16
Joined: Wed Oct 16, 2019 5:38 pm

Re: Log file location

Hi Daniel,

Thanks, now it's clear and I've fixed our installer.

Best regards
Ricardo
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Log file location

You are always welcome, Ricardo.

We are glad you got this working.

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

Return to “Common Problems”