Log with log4net with the loglevel as parameter
问题 Is there a way to log with log4net and use the LogLevel as parameter? That is, instead of writing Log.Debug("Something went wrong"); I would like to write something like this: Log("Something went wrong", LogLevel.Debug); 回答1: According to the log4net documentation here (look under log4net.Core.ILogger ), you can use the Log method on the ILogger interface. private static ILog logger = LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); logger.Logger.Log