cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Christoph
Level 8

Custom, unique logfile name

Hi,

I need to find a possibility to generate a unique logfile name with date and time in its name.

At this moment, I have defined in the setup.exe tab of the release view a logfile name via the MSI command line arguments. Something as /L*v %windir%\temp\<company>_<product>_install.log

We used this approach for a long time already and we want to keep it like this, as this location and naming is known among our service engineers.

BUT... every time the setup is started again, this logfile is overwritten.

So I was wondering If there is a possibility to launch a self-written tool that takes care of making the logfile name unique BUT to launch it at the end of the setup, when no extra logging takes place anymore? This to make sure the logfile is not in use AND is complete.

I was thinking on launching this custom tool when clicking finish on the finish dialog but probably some extra logging takes place AFTER the launching of this custom tool??

Someone can confirm this?

Any idea's about how to handle this (unsolvable) problem.

Something extra I want to say... there is no option to write a wrapper around the setup 😉

 

Labels (1)
0 Kudos

(7) Replies
Revenera_Ian
Revenera Moderator Revenera Moderator
Revenera Moderator

Hi @Christoph,

Thank you for your post.

You could try writing and including a PowerShell custom action in your installer to copy then rename the verbose MSI log file near the very end of the install:

tempFolder = $env:TEMP
$userProf = $env:USERPROFILE
$date = (get-date -format d) -replace("/")
$time = (Get-Date -Format t) -replace(":")
Copy-Item "$tempFolder\Installer.log" -Destination "$userProf\Desktop"
$newFileName = "$date"+"_"+"$time"+"Installer.log"
Rename-Item "$userProf\Desktop\Installer.log" -NewName $newFileName


Or you could try writing a PowerShell script to launch the installer with the custom verbose logging filename:

$DataStamp = get-date -Format yyyyMMddTHHmmss
$logFile = '{0}-{1}.log' -f $file.fullname,$DataStamp

$MSIArguments = @(
"/i"
('"{0}"' -f $file.fullname)
"/qn"
"/norestart"
"/L*v"
$logFile
)
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow


https://stackoverflow.com/questions/55542637/add-date-to-installer-log-file

Please give these options a try. Do either or both work for you?

Please let us know if you have any questions or concerns. Thanks!

0 Kudos

Hi Ian,

Thanks for the fast reply... much appreciated.

Your second proposal is not an option for us. The installer needs to be started by double clicking the setup.exe 😏

Your first proposal... that is also what I wanted to do but my question is here if there is a place to do so to have the complete logging? Because... doing it at the very end of the installation... I'm afraid the logfile is not complete yet, and it need to be to be honest.

Or do I miss something?

Thank you!

0 Kudos

Hi @Christoph,

Thank you for your reply. You're welcome; I'm happy to help.

Understood. You could try configuring a DoAction Event, off of the user clicking the Finish button, to fire off the PowerShell custom action as the very last thing. If you have the option, I would configure the PowerShell custom action to be asynchronous and to ignore the exit code. You could try configuring a pause / wait / sleep for a bit in the PowerShell custom action to allow the installer time to finish writing to the verbose MSI log.

Please give these suggestions a try. Do they work for you?

Please let us know if you have any questions or concerns. Thanks!

0 Kudos

Hi @Revenera_Ian ,

I will give your proposal a try and let you now the outcome.

Thank you!

0 Kudos

Hi @Christoph,

Sounds good.

You are welcome! Thank you for contacting Revenera's InstallShield Technical Support!

0 Kudos

Hi @Revenera_Ian ,

as Powershell script usage don't give you the return processing option 'Asynchronous (No wait for completion)', I had to make an exe that does this job.

Making an exe custom action gives you the option 'Asynchronous (No wait for completion)'... what is what you want in my situation.

 

Thanks for the tips to point me to the correct implementation!

0 Kudos

Hi @Christoph,

Thank you for your reply.

Happy to hear the suggestion(s) worked for you. You are welcome! We are happy to help!

Please let us know if you have any questions or concerns. Thanks!

0 Kudos