I have a few custom event layouts in my configuration like this {event-properties:item=SomeCustomProperty}
Filling them out like this:
var testLogger = testNLogFactory.GetLogger("Test");
LogEventInfo theEvent = new LogEventInfo(LogLevel.Debug, null, "Test");
theEvent.Properties.Add("SomeCustomProperty", null);
testLogger.Debug(theEvent);
I have 2 targets, file and database. File target works fine but in case of database this record won't be written as long as SomeCustomProperty value stays null. If I replace null
with any value, it works just fine.
The corresponding table in the database is correct and allows NULL
values in SomeCustomProperty
but if {event-properties:item=SomeCustomProperty}
has no value the record won't be added to the database.
Is there any reason for this behavior? Is there any workaround?
所有布局渲染器,例如${event-properties:item=SomeCustomProperty}
,如果为空,则将返回一个空字符串,并且不为null
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.