Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
I've been using NLog for a while now and recently decided I wanted to have some of my log files written as Unicode text. I learned that you can specify this in your <target> sections of NLog.config as follows:
<targets>
<!-- add your targets here -->
<target xsi:type="File" name="mainFile" fileName="${logFile}"
archiveEvery="Day" archiveNumbering="Sequence" concurrentWrites="false" maxArchiveFiles="30"
layout="${layout}" encoding="UTF-8" />
</targets>
Note that I only tested two different encodings, "Unicode" and "UTF-8". Also, "UTF-8" must have the hyphen in it to work.