I am finding that when I use webapi.nlog that all the trace records come out with timestamps in UTC not the local time zone. Is this intended?
If I use the standard logger.Trace, logger.Error methods in NLog they all come out with localtime (and are made with localtime timestamps).
I have "fixed" it in my copy by changing the CreateEvent method in NLogTraceWriter to read:
private LogEventInfo CreateEvent(TraceRecord record, LogLevel logLevel)
{
// create new log event info based off TraceRecord properties specified by app
var logEvent = new LogEventInfo
{
Level = logLevel,
Message = record.Message,
LoggerName = record.Category,
Exception = record.Exception,
TimeStamp = record.Timestamp.ToLocalTime()
};
// load properties on the log event, this will be used downstream by the layout renderers
PopulateProperties(record, logEvent);
return logEvent;
}
I am finding that when I use webapi.nlog that all the trace records come out with timestamps in UTC not the local time zone. Is this intended?
If I use the standard logger.Trace, logger.Error methods in NLog they all come out with localtime (and are made with localtime timestamps).
I have "fixed" it in my copy by changing the CreateEvent method in NLogTraceWriter to read:
private LogEventInfo CreateEvent(TraceRecord record, LogLevel logLevel)
{
// create new log event info based off TraceRecord properties specified by app
var logEvent = new LogEventInfo
{
Level = logLevel,
Message = record.Message,
LoggerName = record.Category,
Exception = record.Exception,
TimeStamp = record.Timestamp.ToLocalTime()
};