I am using two RollingFileAppenders
in my application and no root logger is used. I need to turn on and off the logging programmatically during run time.
The below question is useful and it is working to turn off the root logger. Change log4net logging level programmatically
How Can I enable/disable logging for a specific logger?
The following code is working to set the logger level during run time.
((log4net.Repository.Hierarchy.Logger)mylogger.Logger).Level = log4net.Core.Level.Debug;
You can get the logger
using the below line of code.
LogManager.GetLogger("LoggerName")
Please find the actual answer here.