【发布时间】:2019-10-05 07:18:06
【问题描述】:
在我的 ASP.NET MVC 项目中,我在 Web.config 中有以下配置:
<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="default" xsi:type="File" fileName="logs/app-log.txt" layout="
--------------------- ${level} (${longdate}) ----------------------$
IP: ${aspnet-request-ip}
Call Site: ${callsite}
${level} message: ${message}"/> archiveFileName="logs/archives/app-log.{#}.txt" archiveEvery="Day" archiveNumbering="Rolling" maxArchiveFiles="7" />
</targets>
<rules>
<logger name="*" writeTo="default" />
</rules>
</nlog>
如果我的日志消息是波斯语文本,那么在日志文件中我的问号为?????,而不是波斯语文本。
我该如何解决这个问题?任何帮助将不胜感激!
【问题讨论】:
-
尝试在目标元素中指定 encoding="utf-8" 或 encoding="utf-16" 属性
-
我在目标元素中添加了 encoding="utf-8" 不幸的是我有文本 ==> 错误消息:Ù†Ù...اینده ای ب ا این اطلاعات ثبت شده
标签: c# asp.net-mvc nlog