使用以下配置即时通讯。这会为每毫秒创建一个日志文件。 我想每次执行只有一个日志文件,它应该是时间戳记我不想让nlog为每个毫秒创建日志文件
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="logfile" xsi:type="File" fileName="C:\log\log- ${date:format=dd/MM/yyyy HH\:mm\:ss}.txt"></target>
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile" />
</rules>
“每次执行一个日志文件”。这是一个可执行程序,您正在运行还是Web服务器?什么是执行的上下文。另外,您是否为每个类创建1个静态记录器对象,并且整个执行过程将从该对象的单个实例运行? –