I have also recently started playing with log4net. One thing that has tripped me up a couple of times now is that there needs to be an entry in the assembyinfo.cs file. If your're using an xml config file it needs to look like:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4net.config", Watch = true)] On 18 March 2012 19:04, Greg Keogh <[email protected]> wrote: > Does anyone here use log4net? I used it several years ago but found it to > be huge overkill because all I ever wanted to do was write everything to > rolling files. I eventually wrote my own lightweight ‘RollingFile’ class > and have used it for years. Now my logging needs have become a bit more > complicated and I see that the latest log4net has expanded greatly to have > all sorts of fancy appenders and filters. I quite like the idea that I can > send severe error messages via email and boring stuff to a database (or > lots of other interesting combinations like UDP and the event log).**** > > ** ** > > I’ve spent some spare time over the last few days trying to get the > simplest example of writing to the TraceAppender or ConsoleAppender, but no > matter what I do with config files and code I get no output. I have pasted > lines out of dozens of examples and web searched until my eyes bleed > without hope. Stepping deep inside tells me that the library “is not > configured” and it does nothing.**** > > ** ** > > Could any kind person give me a minimal example of some code and a config > file that writes “Hello” to a TraceAppender so it appears in the output > window of VS2010? I am utterly stumped and at wits end.**** > > ** ** > > Thanks, Greg**** >
