如何在Log4Net中创建自定义级别,例如'ERROR', 'WARN', 'INFO'。例如,我想创建一个名为'General'的级别,并将其用作。
logger.General("This is general log");
logger.General("This is general log");
private static readonly log4net.Core.Level GeneralLevel= new log4net.Core.Level(50000,"General");
log4net.Util.LogLog.InternalDebugging=true;
log4net.LogManager.GetRepository().LevelMap.Add(GeneralLevel);
General("This is Custom Log");
public void General(string message)
{
Log.Logger.log(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType,GeneralLevel,message,null);
}