Xml NLog未输出日志文件
好的,我正在尝试在我的项目中实现NLog,我已经设定了一个目标:Xml NLog未输出日志文件,xml,nlog,Xml,Nlog,好的,我正在尝试在我的项目中实现NLog,我已经设定了一个目标: <target name="logfile" xsi:type="File" fileName="${basedir}/logs/${shortdate}/Report/log.txt" /> 或者使用${time}属性,我没有日志。根据他们的意见,longdate和time都应该有效。我错过什么了吗?它们对文件名是否实际有效?我怀疑${longdate}导致文件名无效(Windows不允许):“如/logs/01-
<target name="logfile" xsi:type="File" fileName="${basedir}/logs/${shortdate}/Report/log.txt" />
或者使用
${time}
属性,我没有日志。根据他们的意见,longdate
和time
都应该有效。我错过什么了吗?它们对文件名是否实际有效?我怀疑${longdate}导致文件名无效(Windows不允许):“如/logs/01-10-2013 12:24:25.2567/Report/log.txt中所示”
如果将以下内容添加到nlog.config
<nlog
internalLogFile="c:\temp\nlogproblems.txt"
throwExceptions="true"
xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
你会得到这样的警告
2013-01-10 14:55:21.0436异步处理程序NLog.NLogRuntimeException中出现错误异常:NLog-->System.IO.FileNotFoundException中出现异常:文件名、目录名或卷标语法不正确。(HRESULT的例外:0x8007007B)
编辑:添加了文件时间示例
<nlog
internalLogFile="c:\temp\nlogproblems.txt"
throwExceptions="true"
xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">