Skip to content

Commit 6005bb7

Browse files
committed
Be explicit in that the log file is re-created on every run (i.e. not appended to).
1 parent 4e73031 commit 6005bb7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/GitVersionExe/Program.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,8 @@ static void ConfigureLogging(Arguments arguments)
139139
logFile.Directory.Create();
140140
}
141141

142-
if (!logFile.Exists)
142+
using (logFile.CreateText())
143143
{
144-
using (logFile.CreateText())
145-
{
146-
}
147144
}
148145

149146
writeActions.Add(x => WriteLogEntry(arguments, x));
@@ -163,7 +160,7 @@ static void ConfigureLogging(Arguments arguments)
163160
static void WriteLogEntry(Arguments arguments, string s)
164161
{
165162
var contents = string.Format("{0}\t\t{1}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), s);
166-
File.AppendAllText(arguments.LogFilePath, contents);
163+
File.WriteAllText(arguments.LogFilePath, contents);
167164
}
168165

169166
static List<string> GetArgumentsWithoutExeName()

0 commit comments

Comments
 (0)