public override void SetUp() { TestLoggingConfiguration cfg = new TestLoggingConfiguration(); LogManager.Configuration = cfg; base.SetUp(); }
public void LogsUserStackFrame() { TestLoggingConfiguration cfg = new TestLoggingConfiguration(); LogManager.Configuration = cfg; Common.Logging.LogManager.Adapter = new NLogLoggerFactoryAdapter(null); Common.Logging.LogManager.GetLogger("myLogger").Debug("TestMessage"); Assert.IsNotNull(cfg.Target.LastLogEvent); string stackTrace = cfg.Target.LastLogEvent.StackTrace.ToString(); Assert.AreSame(MethodBase.GetCurrentMethod(), cfg.Target.LastLogEvent.UserStackFrame.GetMethod()); }
public void LogsUserStackFrame() { TestLoggingConfiguration cfg = new TestLoggingConfiguration(); LogManager.Configuration = cfg; Logging.LogManager.Adapter = new NLogLoggerFactoryAdapter((Common.Logging.Configuration.NameValueCollection)null); Logging.LogManager.GetLogger("myLogger").Debug("TestMessage"); Assert.IsNotNull(cfg.Target.LastLogEvent); string stackTrace = cfg.Target.LastLogEvent.StackTrace.ToString(); Assert.AreSame(MethodBase.GetCurrentMethod(), cfg.Target.LastLogEvent.UserStackFrame.GetMethod()); }