一个解决方案,不同项目的NLog只输出到一个文件嘛?
想请教一下:我一个解决方案中有多个项目,每个项目中配了各自的NLog.config文件,每个项目的log输出到不同的文件;发现两个问题:
1.debug的时候,输出的是我启动项目配置的log文件名,但其他项目的log也输出到这里,跟我想的,输出到不同的文件不匹配;
2.程序发布后运行时,发现保存的log是另外一个项目配置的log输出,跟debug时输出的log文件名不同;同样,所有的log也只是输出到这个文件中;
下面是我的配置文件内容;能否帮忙解答一下上面的问题?谢谢
<?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">
<variable name="logDirectory" value="${basedir}/../Logs/ConfigUpdate/ConfigUpdate.log"/>
<targets>
<target
name="logfile"
xsi:type="File"
fileName="${var:logDirectory}"
maxArchiveFiles="5"
archiveAboveSize="10240"
archiveFileName="${basedir}/../Logs/archives_ConfigUpdate/ConfigUpdate.{#####}.log"
archiveNumbering="Sequence"
concurrentWrites="true"
keepFileOpen="false"
layout="${longdate} ${level} ${message} ${callsite:className=false:fileName=True:includeSourcePath=false:methodName=false}${newline}"/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="logfile" />
</rules>
</nlog>