I would like to create an area in my application that will let sysadmins modify logger levels directly.
This answer from 2009 implies that I can do it with
foreach (ILog logger in log4net.LogManager.GetCurrentLoggers())
{
((log4net.Repository.Hierarchy.Logger)logger).Level =
log4net.Core.Level.Error;
}
My application uses log4net 2.0.3 (1.2.13) and this seems to not be available as no implementation of ILog inherits that class.
Instead I can grab each ILog's Logger property for an instance of ILogger. This gives me the name but will not let me query or set the Level. While this is an ability that IS available on the implementation I cannot simply do a cast as the implementation is an internal class.
How do I do this in recent versions?