Martin Martin - 15 days ago 8
C# Question

forward from log4net to NLog

In my current project I'm using two libraries where one is using log4net and the other NLog for its logging. I'm personally prefer NLog so it is used in my application as well.

I'm not knowing much about log4net so I'm asking what would be the best way to programmatically forward all the messages from log4net to NLog.

There is a post about a log4net forwarder at the NLog forum but it looks like no one had done this before.

Answer

create a custom log4net Appender that logs the messages to a nlog logger. this may be at least the solution if you just want to pass the log information to nlog instead of replacing all occurences of log4net logging with nlog.

look here, here and here