是否可以在internalLogFile中使用$ {shortdate}? [英] Is it possible to use the ${shortdate} in the internalLogFile?

查看:142
本文介绍了是否可以在internalLogFile中使用$ {shortdate}?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在internalLogFile中使用${shortdate}?

<nlog internalLogFile="C:\Logs\${shortdate}_nlog.log"
    <targets>
        <target name="logfile"
                fileName="C:/logs/${shortdate}_dev.log"
        </target>

我正在获取预期日期的日志文件,但是内部日志文件被命名为... ${shortdate}_nlog.log

I'm getting the expected dated logfile, but the internal log file is named ... ${shortdate}_nlog.log

推荐答案

简短答案:否.

更长的答案:内部记录器文件名只是一个字符串.在初始化期间将其读入,并且XmlLoggingConfiguration类确保该目录存在,而(例如)FileTarget使用Layout作为fileName来转换使用LayoutRenderers提供的值.

Longer answer: The internal logger file name is just a string. It's read in during initialization and the XmlLoggingConfiguration class ensures that the directory exists whereas (for example) the FileTarget uses a Layout for fileName that converts the value provided using LayoutRenderers.

这篇关于是否可以在internalLogFile中使用$ {shortdate}?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆