It's hard to tell without seeing the calling context, but the general answer is here:
https://stackoverflow.com/a/4660186/4406646
Specific to log4net, depending on the configuration loggers can (and usually) have multiple levels configured. You also control what level is called with the methods described here:
https://logging.apache.org/log4net/release/sdk/html/Methods_T_log4net_ILog.htm
To get a string value related to level was used for a ILog method call, you could wrap the call like this:
MyLogger.cs
using System.Reflection;
using log4net;
namespace YourNamespace
{
internal static class MyLogger
{
private static readonly ILog Logger =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
internal static string LogSomething()
{
Logger.Info("something");
return "Info";
}
}
}
Elsewhere in YourNamespace
string strLogLevel = MyLogger.LogSomething();