Search code examples
httppostlog4netappender

log4net: Is there an easy way to use HTTP POST to send error logs to a URI?


I'm pretty new to Log4Net (I used log4j), and I'm wondering the best strategy for sending error logs (on Error or Fatal Error) to a URI. The server's already set up and listening.

I was going to risk re-inventing the wheel and extend the AppenderSkeleton class to create a POSTAppender. Is there any easier way to do it?


Solution

  • There is not an easier way to do it. Extending AppenderSkeleton is fairly easy and I'd recommend trying your hand at it. There's only one method you're required to override, Append(LoggingEvent loggingEvent).

    For your specific Error or Fatal requirements, you could use a threshold setting or a Filter in your log4net configuration.

    For reference, there is a list of built-in appenders for log4net.