I've got a C# (.NET 3.5) application that extensively use log4net. The log4net configuration resides in the app.config
file.
Configuration is done using [assembly: XmlConfigurator(Watch = true)]
in AssemlyInfo.cs
App uses single application-wide logger instance, instantiated in a static constructor of a logger wrapper class:
public class Logger{
//....
private static readonly ILog logger;
static Logger()
{
logger = LogManager.GetLogger(Assembly.GetEntryAssembly().GetName().Name);
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
}
//....
}
The app is designed to be run on distant server, by scheduler, with no human presense, alone in the dark. :) The problem is, in case of missing config file it just silently crashes (no log4net config => no logging).
Are there any way to check if there are any appenders in the config, and if not - programmatically add some kind of fallback appender.
I'm rather new to log4X loggers family, so, if I'm asking something trivial - please be kind, log4net documentation is really awful. :)