Answer the question
In order to leave comments, you need to log in
How to write Cyrillic to file using log4net appender?
Good afternoon, dear colleagues.
The project uses log4net.
There was a need to write an API response to the log, which sends a message in Cyrillic. In response header ContentType = "text/json;charset=utf-8"
using (Stream stream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(stream))
{
answer = reader.ReadToEnd();
Logger.Debug(answer);
File.AppendAllText("Logs/msg.txt", answer);
}
}
{"ErrorMessage":"Service not available"}
2020-07-09 16:16:31,279 DEBUG {"ErrorMessage":"???????????????????????"}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question