简体   繁体   English

如何检查NLog是否写入数据库

[英]How to check if NLog writing to database

In our application, we are using nlog for log management. 在我们的应用程序中,我们使用nlog进行日志管理。 We are writing the log in both text files and databases. 我们在文本文件和数据库中编写日志。 In some cases, the log is getting written in the text file, but not in the database. 在某些情况下,日志将写入文本文件中,但不会写入数据库中。 I doubt it is due to some problem while setting the connection string dynamically. 我怀疑这是由于动态设置连接字符串时的一些问题。 How can I debug that? 我该怎么调试呢? Is there a way to write the sql queries and responses generated by NLog in a console? 有没有办法在控制台中编写NLog生成的sql查询和响应? Also let me know if there is some work around for this. 如果有一些解决方法,请告诉我。

You can configure nlog to do logging about nlog it self: 您可以配置nlog来自行记录nlog:

NLog internal logging NLog内部日志记录

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

or have a look at: 或者看看:

Logging not working, how to troubleshoot 记录不起作用,如何排除故障

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM