How do you write a byte [] array using log4.net
I have a byte [] with some data in it, I would like to write this AS-IS byte array to a log file using log4.net. The problems I am facing is that
There is no overload for the [] byte in the TextWriter , so even the IObjectRenderer implementation is useless. I don't have access to the underlying Stream Log4.net object Also tried converting byte [] to char [] yet when I write it it adds extra byte.
Is this possible with Log4.net.
Thanx in Advance.
a source to share
Log files are usually text files. It is probably best to register your byte array as a string.
Have a look at BitConverter.ToString or Convert.ToBase64String .
a source to share
I also find that writing any larger data is useless, however, I think this is what you are looking for - this will convert your bytes to a string.
System.Text.Encoding.ASCII.GetString(byteArray)
I believe you can figure out how to use this for logging.
Pz, developer of TaskConnect
a source to share