小编Cor*_*tro的帖子

NLog不使用ClickOnce进行日志记录

我正在通过NLog在我的应用程序中实现日志记录.这是我的Nlog.Config:

 <?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <targets async="true">
    <target xsi:type="File"
            name="ExceptionTarget"
            fileName="LOG.txt"
            layout="${date:format=dd MMM yyyy HH-mm-ss} ${uppercase:${level}} ${newline}${message} ${exception::maxInnerExceptionLevel=5:format=ToString}${newline}${stacktrace}${newline}"/>
  </targets>

  <targets async="true">
    <target xsi:type="File"
            name="InfoTarget"
            fileName="LOG.txt"
            layout="${date:format=mm-ss} ${uppercase:${level}} ${newline}${message} ${newline}"/>
  </targets>

  <rules>
    <logger name="*" level="Error" writeTo="ExceptionTarget"/>
    <logger name="*" level="Info" writeTo="InfoTarget"/>
  </rules>
</nlog>
Run Code Online (Sandbox Code Playgroud)

当我使用ClickOnce部署应用程序时,没有创建log.txt文件.没有错误发生,我的应用程序正常运行,但没有发生任何事情.

如何解决这个问题呢?

.net c# clickonce nlog

7
推荐指数
1
解决办法
1111
查看次数

标签 统计

.net ×1

c# ×1

clickonce ×1

nlog ×1