// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using log4net; using log4net.Config; namespace Logging.Log4Net { public class Test { private static readonly ILog log = LogManager.GetLogger(typeof(Test)); public static int Fac(int n) { int res; if (n <= 1) { res = 1; } else { res = n * Fac(n - 1); } if(log.IsDebugEnabled) { log.Debug("fac : n = " + n + " res = " + res); } return res; } public static void Main(string[] args) { XmlConfigurator.Configure(); log.Info("Start"); Console.WriteLine(Fac(50)); log.Info("End"); } } }