No log output with log4net assembly statement inserted - why?
In my project, I have a DLL reference which uses log4net internally. In my
Main class I inserted the following two statements:
using log4net;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
I also prepared an App.Conf file.
With only the above, the logging does not start. But when I additionally
add the statement
private static readonly ILog log = LogManager.GetLogger(typeof(Main));
to my Main class, the logging starts and all works fine.
Why do I have to create an ILog object to trigger logging to start?
Shouldn't the assembly statement with my App.Conf file be sufficient?
No comments:
Post a Comment