Skip to content

Commit 1504b3b

Browse files
authored
Fix: Log exception stack traces (#12004)
1 parent 86b6df4 commit 1504b3b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Files.Shared/FileLogger.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
3030
semaphoreSlim.Wait();
3131
try
3232
{
33-
File.AppendAllText(filePath, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss.ffff}|{logLevel}|{formatter(state, exception)}" + Environment.NewLine);
33+
var message = exception?.ToString() ?? formatter(state, exception);
34+
File.AppendAllText(filePath, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss.ffff}|{logLevel}|{message}" + Environment.NewLine);
3435
}
3536
catch (Exception e)
3637
{

0 commit comments

Comments
 (0)