[英]NLog isn't writing an empty custom event propperties into SqlDatabase
我的配置中有一些自定義事件布局,例如{event-properties:item=SomeCustomProperty}
像這樣填寫它們:
var testLogger = testNLogFactory.GetLogger("Test");
LogEventInfo theEvent = new LogEventInfo(LogLevel.Debug, null, "Test");
theEvent.Properties.Add("SomeCustomProperty", null);
testLogger.Debug(theEvent);
我有2個目標,文件和數據庫。 File target可以正常工作,但是在數據庫情況下,只要SomeCustomProperty值保持為null,就不會寫入該記錄。 如果我將null
替換為任何值,則可以正常工作。
數據庫中的對應表是正確的,並且在SomeCustomProperty
允許使用NULL
值,但是如果{event-properties:item=SomeCustomProperty}
沒有任何值,則該記錄將不會添加到數據庫中。
是否有任何這種行為的原因? 有什么解決方法嗎?
所有布局渲染器,例如${event-properties:item=SomeCustomProperty}
,如果為空,則將返回一個空字符串,並且不為null
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.