English 中文(简体)
How do i stop log4net from logging when running tests in NUnit TestRunner
原标题:

Let me explain my scenario first:

  1. I have around 2000 tests to run, which take about 30 seconds in NUnit
  2. I want to find out what s taking the time
  3. I open Ants Profiler, and get it to profile the NUnit TestRunner, and load my test dll into the TestRunner
  4. I then run the tests...

However, running the tests whilst profiling takes a lot longer (about 5 minutes to run all the tests, rather than 30 seconds). When i look through the timings in Ants Profiler, it seems log4net is being called in a lot of places, which seems to be taking up the time.

So, this is my question: how do i stop log4net logging stuff when i m running the tests in this manner?

I can find 3 config files:

  1. In the test dll folder, there s a config.log4net file. I ve put <level value="OFF" /> in there, and deleted all the appender sections
  2. In the test runner folder, there s a nunit.exe.config, and a nunit-console.exe.config file - i ve put <level value="OFF" /> in both of those.
  3. I can t find any config files to play with in the ants profiler folder.

None of this seems to work, looking through the profile results i can see log4net being called, and it s definitely calling methods to output the logging information.

最佳回答

In the test setup, get the root logger and set it s log level to OFF.

问题回答

暂无回答




相关问题
Log4Net and extra fields

Is it possible to insert extra fields into the database and use them in log4net? I have a UserId I would like to have in an extra field in the log-table. I have added the field in the log4net.config:...

log4net with .NET 4.0

I ve thrown together some code to tinker with the new .Net 4.0/VS 2010 pieces, but I can t seem to find a build of my logging framework of choice (log4net) for 4.0, and I m getting reference errors ...

Best logging approach for composite app?

I am creating a Composite WPF (Prism) app with several different projects (Shell, modules, and so on). I am getting ready to implement logging, using Log4Net. It seems there are two ways to set up the ...

log4net log files disappear when service restarted

We are using log4net to create our logfiles from Windows services, and we are using the RollingFileAppender rolling based on date. The version of log4net we are using is 1.2.9. Now for the issue. ...

How do I use a date pattern in a header/footer?

Here s my appender configuration from my app.config. This just prints out the literal string instead of translating it to the date (i.e., it literally prints "[START: %date{MM/dd/yy HH:mm} ]"). <...

热门标签