Overwrite logfiles instead of append

A customer requested that there should be only one logfile per product and deployment type (default) - but only for the latest installation.
He obviously doesn’t like scrolling :wink:

For the lack of better knowledge my solution was to add the following lines to AppDeployToolkitMain.ps1
after the “write-log” function (line 700 in v3.6.0):

[string]$LogFilePath = Join-Path -Path $LogDirectory -ChildPath $LogName
if (test-path $LogFilePath) {Clear-Content –Path $LogFilePath}

For me that was not self explanatory and took some testing and puzzling, so I decided to share this in case anybody has the need to do the same.

1 Like

Nice feature request. Thank you.