views:

174

answers:

2

The problem is NHibernates dependany on log4net. I am trying to build an IoC app with interchangable Loggers, and this thing gets in the way.

Is there a build out there without this dependancy or do I have to do some open source code hacking myself?

+5  A: 

There is already an open bug on NHibernate bug tracker regarding this issue and one or more patches already exist so you could use that ones. The problem is that they are not integrated yet on trunk so YMMV...

Nikos D
thanks for that. I just downloaded the source, ripped out Log4Net, and hooked all calls to an adapter LogManager that I can use IoC on. Had to remove alot of NHibernate tests :( but thats life when your hacking code
burnt_hand
yeap, but that's also the good thing: you *are* able to hack the code ;)
Nikos D
A: 

Yes it's currently a hard dependency. I think you can get what you want by creating an appender for log4net and then injecting your real logger into that appender. So essentially you'll have log4net log to your logging api which will use the real logger you inject.

You may also want to look at this semi-related question: Using Enterprise Library Logging Application Block in NHibernate

Daniel Auger
Ah I see how that works. If I need to I will use that method, but I have got the hack to work for now so will use that till it bugs out.
burnt_hand