can anyone suggest how to configure the log4net for an console app?
Or at least how/where to catch the Application_Start
event? (It seams that some calls are required at this moment)
Thanks in advance!
can anyone suggest how to configure the log4net for an console app?
Or at least how/where to catch the Application_Start
event? (It seams that some calls are required at this moment)
Thanks in advance!
You need to configure it before the first logger is instantiated.
To do so:
Your main class (Program.cs) should not have a logger
The main method should not reference any classes that have a logger.
You can then configure log4net in the main method.
Alternatively you can use a wrapper class to instantiate loggers, that ensures log4net is configured before creating a logger, e.g.: