Overwrite logfiles instead of append

//Overwrite logfiles instead of append
Overwrite logfiles instead of append 2015-05-04T14:21:09+00:00

The Toolkit Forums General Overwrite logfiles instead of append

  • Author
    Posts
  • Thomas
    Participant
    Post count: 1
    #207 |

    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 😉

    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):

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

    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.

You must be logged in to reply to this topic.