在app config中配置Nlog路径 [英] Config a Nlog path in app config

查看:661
本文介绍了在app config中配置Nlog路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将日志文件放在给定的路径中。它位于类库项目的app.config中,比如我想将日志保存在C:\ Test \ log.txt或网络路径中。



怎么做?

目前我有

I want to put the log file in a given path. It is in app.config in a class library project, say I want to save the log in "C:\Test\log.txt" or a network path.

How to do it?
Currently I have

<targets>
    <target  xsi:type="Console"
             name="console"
             layout="${shortdate} ${level} ${message}" />
    <target name="logfile" xsi:type="File"
    fileName="${specialfolder:folder=ApplicationData}/LogFile.txt"/>
  </targets>

推荐答案

{shortdate}
{shortdate}


{level}


{message} />
< target name = logfile xsi:type = 文件
fileName =
{message}" /> <target name="logfile" xsi:type="File" fileName="


这篇关于在app config中配置Nlog路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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