I am trying to provide tools for reporting errors that occur in our Flex client by providing a SOAP web service that takes a LogMessage object as the only parameter.
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 if the client-side error surface and the LogClientError method are called, which logs the error through log4net.
[WebMethod()] public void LogClientError(LogMessage message) { rollingLogger.Error(message); }
This currently prints the full name of the LogMessage class, so my current assumption is that log4net just calls .ToString () on the passed object.
However, what I really want to do is map each property in the LogMessage class to a template so that log4net correctly writes the necessary information. I would like to do this in such a way that typical applications (DB, File, SMTP) are still supported.
How to configure log4net so that object properties can be mapped to log output?
source share