小编use*_*597的帖子

使用Nlog登录多个文件

我正在使用NLog进行日志记录.

我的代码如下:

<?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">

  <!-- make sure to set 'Copy To Output Directory' option for this file -->
  <!-- go to http://nlog-project.org/wiki/Configuration_file for more information -->

  <targets>
    <target
      name="logfile"
      xsi:type="File"
      layout="${message}"
      fileName="${basedir}../Data/debugLog1.txt"
      archiveAboveSize ="5000000"
      maxArchiveFiles="2"/>
  </targets>

  <rules>
    <logger name="*" minlevel="Trace" writeTo="logfile" />
  </rules>
</nlog>
Run Code Online (Sandbox Code Playgroud)

我正在记录数据debugLog1.txt.现在从项目的另一个位置我也想记录数据,但这个数据是另一种类型,所以我想制作一个debugLog2.txt并记录数据.如何修改上面的代码来执行此操作

c# nlog winforms

28
推荐指数
3
解决办法
2万
查看次数

标签 统计

c# ×1

nlog ×1

winforms ×1