是什么在n日志时间标志的含义时,异步是吗? [英] What's the meaning of the time stamp in nlog when async is on?

查看:270
本文介绍了是什么在n日志时间标志的含义时,异步是吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对NLOG的behivor有点困惑当我设置异步=真在NLOG的配置文件。

  1. 是日志文件present时间戳的时候, logger.Debug /错误/信息/跟踪被调用,或者是它的时间日志从缓冲区得到写入到文件系统上的文件?
  2. href="http://stackoverflow.com/questions/15607930/nlog-async-and-log-sequence"> NLOG异步和日志序列提到答
  3. 如果我设置异步=真,它一直在做的时候影响结果性能测试?
解决方案
  1. 据该NLOG来源:的https:/ /github.com/NLog/NLog/blob/master/src/NLog/Logger.cs 的LogEventInfo objectc在记录通话的时间创建(的时间戳在这一点)。该LogEventInfo对象的写作被写入,异步,到适当的目标(S)。因此,在日志文件中的时间戳应该重新present日志记录调用自身的日志信息,而不是时间的时间戳被写入日志文件中。

  2. 我没有什么可以补充的链接答案。我会说, xharze 参与NLOG发展,所以他应该知道他在说什么。

  3. 我的第一个猜测是,设置异步=真将提高相对于记录应用程序的性能,因为应用程序将不必等待日志请求继续执行之前完成。

I'm a little confused about NLog's behivor when I set async=true in NLog's configuration file.

  1. Is the timestamp in the log file present the time when logger.Debug/Error/Info/Trace is called, or is it the time that the log got written from buffer to file on the file system?
  2. Answer Nlog Async and Log Sequence mentioned that the order of the log sequence is not guaranteed when async is on, is that true?
  3. If I set async=true, does it has influence to the result when doing performance testing?

解决方案

  1. According to the NLog source: https://github.com/NLog/NLog/blob/master/src/NLog/Logger.cs the LogEventInfo objectc is created at the time of the logging call (and is timestamped at that point). The writing of the LogEventInfo object is then written, asynchronously, to the appropriate target(s). So, the timestamp in the logfile should represent the timestamp of the logging call itself, not the time of the logging info being written to the log file.

  2. I don't have anything to add to the linked answer. I will say that xharze is involved in NLog development, so he should know what he is talking about.

  3. My first guess is that setting async=true would improve performance of your application with respect to logging since the application would not have to wait for a logging request to complete before continuing execution.

这篇关于是什么在n日志时间标志的含义时,异步是吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆