Search code examples
c#logginglog4neterror-logging

Log4Net: Writing a C# object (apart from Exception) to the log?


I have seen in Log4Net you can write a message and pass as the second parameter the Exception Object.

Is it possible to send another type of object to log4net so I can see the values in my log of my object?

If i have an instance of a class that is populate and I went to send the instance along to be logged,

Is this at all possible?


Solution

  • You can implement a custom formatter. (Try Googling first to see if anyone has made something that fits your scenario).