Reputation: 5875
I upgraded my WinForms project to NH 3.2, and saw somewhere that it no longer requires Log4net to produce logging info.
Is this correct?
I now need to turn on logging, but I've been unable to find that reference again.
How do you enable logging in NH 3.2?
I'm not currently using a config file - if that's a requirement, please provide a sample.
Also, I prefer to log to the Visual Studio Output window, but anything that works is fine.
Upvotes: 1
Views: 1377
Reputation: 5875
I may have been unduly harsh on log4net...
More than a year ago, I had set it up, adding a section in my app.config file, as suggested in all the blog posts I had read.
It worked for me briefly, and then mysteriously stopped working. There are many, many questions on SO describing similar unpleasant experiences.
Have not needed it since then, so ripped the dll and config out of my project in disgust.
Though I'm certain I've tried this before, and that it silently failed to do any logging whatsoever, I added the following single line back to my code:
log4net.Config.BasicConfigurator.Configure();
and lo and behold, it started logging to the VS Output window, just like I wanted.
So it appears there's no need to configure it at all for simple applications - it does the right thing by default. Presumably, it's the complex configuration that trips people up - it seems far too easy to mess things up.
Upvotes: 1