I have created a simple log4net custom appender, code below, to access a JSON Web Service. Everything seems to initialize correctly, but the Append method is never called. Can someone please tell me what I am doing wrong. Thanks
public class RMAppender : AppenderSkeleton
protected override void Append(LoggingEvent loggingEvent)
var url = ConfigurationManager.AppSettings["EventLogServer"];
if (string.IsNullOrEmpty(url)) return;
var client = new JsonServiceClient(url);
var data = loggingEvent.MessageObject as IList<string>;
if (data != null)
foreach (var s in data)
// Do something with each string
var log = new LogEntry
CurrentAppDomain = loggingEvent.Domain,
Logger = loggingEvent.LoggerName,
Date = DateTime.Now
var response = client.Post<LogEntry>(log);
This is configured in code using:
private static void ConfigureLog()
var root = ((Hierarchy)LogManager.GetRepository()).Root;
var append = new RMAppender();
append.Threshold = Level.All;
root.Repository.Configured = true;
I have used this same method for adding other appenders including EventLog, SMTP etc. and they all work. It is only the custom one that Append is never called.
I checked root, and following the above, the appender is listed under root.Appenders, and appears to be configured the same way as all the other appenders.
This has got me really stumped. I am sure I am missing something, but I cannot see what.