【问题标题】:How to check if NLog writing to database如何检查 NLog 是否写入数据库
【发布时间】:2013-03-14 06:17:03
【问题描述】:

在我们的应用程序中,我们使用 nlog 进行日志管理。我们在文本文件和数据库中写入日志。在某些情况下,日志会写入文本文件,但不会写入数据库。我怀疑这是由于动态设置连接字符串时出现的一些问题。我该如何调试呢?有没有办法在控制台中编写 NLog 生成的 sql 查询和响应?如果有解决办法,也请告诉我。

【问题讨论】:

  • ekanthike tamar badi kotho dur?
  • 有没有抛出异常?调试自己的代码时会发生什么?

标签: c# .net database connection-string nlog


【解决方案1】:

您可以配置 nlog 以自行记录有关 nlog 的日志:

NLog internal logging

<nlog internalLogFile="c:\log.txt" internalLogLevel="Trace">
   <targets>
      <!-- target configuration here -->
   </targets>
   <rules>
      <!-- log routing rules -->
   </rules>
</nlog>

或者看看:

Logging not working, how to troubleshoot

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-04
    • 1970-01-01
    相关资源
    最近更新 更多