We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cdce12d commit 764ae5aCopy full SHA for 764ae5a
src/Serilog.Enrichers.Thread/Enrichers/ThreadNameEnricher.cs
@@ -38,7 +38,11 @@ public class ThreadNameEnricher : ILogEventEnricher
38
/// <param name="propertyFactory">Factory for creating new properties to add to the event.</param>
39
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
40
{
41
- logEvent.AddPropertyIfAbsent(new LogEventProperty(ThreadNamePropertyName, new ScalarValue(Thread.CurrentThread.Name)));
+ var threadName = Thread.CurrentThread.Name;
42
+ if (threadName != null)
43
+ {
44
+ logEvent.AddPropertyIfAbsent(new LogEventProperty(ThreadNamePropertyName, new ScalarValue(Thread.CurrentThread.Name)));
45
+ }
46
}
47
48
#endif
0 commit comments