Event log writer empty EventTime

Aaron Macdonald asked on March 22, 2023 02:25

Hi all

We've implemented an event log writer in K13 (.NET framework) to send all logs to an Azure Analytics workspace, as described here:


Everything seems to work as expected except for one problem. The EventLogData.EventTime as received by the WriteLog() method is always empty i.e. appears with default value 1/1/0001 12:00:00 AM. Event time is present when viewed in the original event logs.

Our logging settings are all default and there don't seem to be any settings which would have an impact.

Thanks in advance for advice on the issue.

Recent Answers

Dmitry Bastron answered on March 27, 2023 08:49

Hi Aaron,

In the page you are referring to, in the example implementation of CsvErrorEventWriter there is a use of DateTime.Now which makes me think it might be by design, and you can use the same workaround in your code. It should be safe enough, cause the actual "time" of error would differ from "logging time" by only a couple of ticks.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.