Possible to copy the verbose log after install to AppDir? - Advanced Installer Community
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Possible to copy the verbose log after install to AppDir?

Has anyone managed to find a way to copy the default verbose log file from the MsiLogFileLocation to their AppDir folder so that it's retained over time and not buried in some %Temp% folder?

I read in the AI help that:
The MsiLogFileLocation is a Read-only property and cannot be changed by the package author or by the user. It's value is automatically set during the run time of the installation package.
So I would like to know if there is a way to copy that file to an easier-to-find location (such as AppDir) and give it a friendly name like "Install.log" so that if a user reports my application is not running then I can have them find that Log file and send it to me so that I can see what was done during installation time.

Ideally --if the above is possible-- the [AppDir]\Install.log file should be appended to, so that as each version is installed/updated the installation log history is not lost.

Thanks.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Possible to copy the verbose log after install to AppDir

Hello,

One approach to achieve this, is the one where you use the launch file predefined custom action without sequence to launch .bat file that can be something like that:
copy %1 %2
where:
%1 specify the file to be copied
%2 specify the destination folder

This means that in the Launch file custom action properties you will have something like:
File to Launch: [#myFile.bat]
Command Line:: "[MsiLogFileLocation]" "[APPDIR]Install.log"
Please notice that you have to enable the Enable verbose logging and Run as administrator options from Install Parameters page.

Then, in the dialogs page, on the Finish button from the ExitDialog you can add a Published Event to launch the custom action execution. Please take a look on the How do I execute a custom action when a button is pressed article which may be useful to you.

Another approach is the one where you create your own custom action as a custom action written in C# or a custom action written in C++ to copy the related file.

Then you can go in the “Custom Actions” page and add a predefined Launch attached file custom action without sequence. This type of custom action can execute an application (EXE or DLL) or run a script (VBScript or Java script). Also, the source file will be embedded in the MSI file but will not be deployed at install time with the other application files.

Please let us know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Possible to copy the verbose log after install to AppDir

Thank you Dan.
I chose the BAT file method and I now launch that BAT file when the user clicks the Finish button. So it's copying the MSI Log file to my AppDir folder now.

I wish the log files were a little more human friendly, and a lot shorter. Like

Launched MSI from location
Created Prorgram Files folder
Created sub-folder
Copied Application Files
Created INI files
Exiting MSI normally

A lot of the verbose Install log file is not good info for me (admittedly as MS Installer newbie), but it will never be useful to a user.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Possible to copy the verbose log after install to AppDir

Hello,

The information in a verbose log can be helpful when trying to troubleshoot Windows Installer package deployment. This is also a reason why you get all these details.
A very useful resource for interpreting Windows Installer log files is Wilogutl.exe. Also, you can take a look on the Windows Installer Best Practices – verbose logging article which may be useful to you.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Possible to copy the verbose log after install to AppDir

Nice. That WILogUtl info will no doubt prove to be very helpful in the weeks and months to come. Thank you!
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Possible to copy the verbose log after install to AppDir

You're welcome.

If you need any help, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Possible to copy the verbose log after install to AppDir

Hi Dan,
Another related question about the verbose install.log file. I have the logging the way I need it now in my testing scenarios, but on un-install I deliberately try to leave the Instll.log file behind (I do not delete it), so that when the next installation happens (or in the case of installing a full setup on top of an existing installation) I would like to append to the Install.log file, or otherwise backup the one that was there so that the history of installation log files is not lost.

Do you have a recommendation for what we would like to accomplish? Should I consider doing some sort of "file rename" Custom Action at the start of the full setup --in case a log file is present-- or is there a better solution?

Thanks.
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Possible to copy the verbose log after install to AppDir

This is what I have done and I thought I might share it in case it proves useful for others.
I created a BAT file that I call as a Custom Action on the "Finish>" button click. The action is to call the BAT file with two command line params, e.g.
File To Launch:

Code: Select all

[#CopyInstallLog.bat]
Command Line:

Code: Select all

"[MsiLogFileLocation]" "[APPDIR]Install.log"
The contents of the BAT file looks like this:

Code: Select all

@echo off
REM usage: CopyInstallLog.bat MSILogFileLocation, Install.log
ren %2 Install_Hist.log
copy Install_Hist.log+%1, %2
del Install_Hist.log
So to de-construct each line, this is what is happening:
1) the "live" install.log file that is in the AppDir folder is renamed to Install_Hist.log; this "frees-up" the final name of "Install.log" for the next set of commands in the BAT file
2) the Install_Hist.log file and the current installation sessions' MSI log file are then combined (or merged) into a file called Install.log; the merging is a result of the "+" (plus) sign; I am appending the latest info at the bottom of the file (so I do <history log file>+%1, if you want the newest install log entries at the top you just reverse the order, such as %1+Install_Hist.log)
3) the Install_Hist.log file is then deleted and what we are left with is the cumulative Install.log file, which will continue to be appended to as each subsequent installation of our application occurs

Hopefully this proves helpful to someone else on the forums in the days and weeks to come.

Regards,
Kevin
Last edited by kjullion on Fri Dec 27, 2013 3:22 pm, edited 1 time in total.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Possible to copy the verbose log after install to AppDir

Hello Kevin,

I'm glad you got this working.
Thank you for your contribution to Advanced Installer forums. I'm sure this will help someone in the future.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Possible to copy the verbose log after install to AppDir

Hi,
I have been trying to improve on my BAT file (where I retain older Install.log files from prior installations), but I'm having a problem. Here is the latest BAT file which I know to be valid and doing waht I want because if I run the BAT file interactively after an installation it does what I need it to do in both scenarios (1, where the install.log file is not already present -that is, the Else logic is in effect-, and 2) when there is an Install.log file present).

Code: Select all

@echo off
REM usage: CopyInstallLog.bat [MSILogFileLocation], [AppDir]Install.log

IF EXIST %2 (
rename %2 Install_Hist.log
copy Install_Hist.log + %1 %2
erase Install_Hist.log
goto END
) else (
copy %1 %2
goto END
)
:END
pause
ADDENDUM: I think the code above should work but it's a bit uneasy with the UAC issue of a Limited User doing an Update install when they don't have any rights in the AppDir folder.

The problem I'm having is that when I include this BAT file as a Custom Action during my testing I do not see it having the desired effect. It is almost as though the Custom Action or BAT file is no longer being called during the final step of my installer. I have attached a sample MSI LOG file so maybe you can see if what is wrong?

My Custom Action > Launch File settings look like this:

> Properties
File to Launch: [#CopyInstallLog.bat]
Command Line: "[MsiLogFileLocation]" "[APPDIR]Install.log"
Working Directory: [APPDIR]
(checked) Hide program's window
(checked) Run As Administrator

> Execution Time
Immediately

> Execution Options
(checked) Wait for custom action to finish before proceeding
Attachments
MSI66098.LOG
(769.8 KiB) Downloaded 544 times
Last edited by kjullion on Thu Jan 02, 2014 10:08 pm, edited 1 time in total.
kjullion
Posts: 176
Joined: Mon Nov 11, 2013 9:02 pm

Re: Possible to copy the verbose log after install to AppDir

I have found a work-around for this latest problem. I'm no longer trying to copy/preserve the historical Install.log file; I didn't like the fact that it was saving to the AppDir when a Limited User might do an update installation and not have access to that folder (w/o UAC). So I'm now just copying each MSI log file after installs are done to a sub-folder that our app creates in the PublicDocumentsFolder tree.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Possible to copy the verbose log after install to AppDir

Hello,

I'm glad you got this working. If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”