I am attempting to provide a means to log errors that occur in our Flex client by providing a SOAP web service which takes as a single parameter a LogMessage object.
public class LogMessage
{
public string Message { get; set; }
public string Exception { get; set; }
public string Version { get; set; }
public string User { get; set; }
}
This object is populated by the Flex client should a client side error surface and the LogClientError method is invoked which logs the error via log4net.
[WebMethod()]
public void LogClientError(LogMessage message)
{
rollingLogger.Error(message);
}
Currently this prints the fully qualified name of the LogMessage class, so my current assumption is that log4net simply calls .ToString() on the object that is passed in.
However, what I really want to be able to do is map each property in the LogMessage class to a pattern so that log4net will correctly write out the desired information. I would like to do this in such a manner that the typical appenders (DB, File, SMTP) are all still supported.
How do I configure log4net such that properties of an object can be mapped to the log output?