Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Out of the box, I don't believe that the EnterpriseLibrary.Logging application block supports output to utf-8. It appears to only output to the default ANSI. That being said, you could always write your own TraceListener that would output to utf-8.</p> <p>Untested code. I wrote it quick and dirty. Watch the hard coded file path:</p> <pre><code>using System; using System.Text; using System.Diagnostics; using Microsoft.Practices.EnterpriseLibrary.Logging; using Microsoft.Practices.EnterpriseLibrary.Logging.Configuration; using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners; using Microsoft.Practices.EnterpriseLibrary.Common.Configuration; namespace YourNamespace { [ConfigurationElementType(typeof(CustomTraceListenerData))] class UTF8Logging:CustomTraceListener { public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data) { if (data is LogEntry &amp;&amp; this.Formatter != null) { this.WriteLine(this.Formatter.Format(data as LogEntry)); } else { this.WriteLine(data.ToString()); } } public override void Write(string message) { this.WriteLine(message); } public override void WriteLine(string message) { string fileName = @"C:\Your.log"; using (StreamWriter sw = new StreamWriter(File.Exists(fileName) ? System.IO.File.Open(fileName, FileMode.Append) : System.IO.File.Create(fileName), Encoding.UTF8)) { Byte[] logMessage = new UTF8Encoding(true).GetBytes(message); sw.Write(logMessage,0,logMessage.Length); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload