Let me explain my scenario first:
让我先解释一下我的设想:
- I have around 2000 tests to run, which take about 30 seconds in NUnit
- 我有大约2000个测试要运行,在NUnit中大约需要30秒
- I want to find out what's taking the time
- 我想知道花时间做什么
- I open Ants Profiler, and get it to profile the NUnit TestRunner, and load my test dll into the TestRunner
- 我打开ant剖析器,让它配置NUnit TestRunner,并将测试dll加载到TestRunner中。
- 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.
然而,在分析的同时运行测试要花费更长的时间(运行所有测试大约5分钟,而不是30秒)。当我查看蚂蚁剖析器的计时时,似乎log4net正在很多地方被调用,这似乎占用了时间。
So, this is my question: how do i stop log4net logging stuff when i'm running the tests in this manner?
所以,这就是我的问题:当我以这种方式运行测试时,如何停止log4net日志记录?
I can find 3 config files:
我可以找到3个配置文件:
- 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
-
在测试dll文件夹中,有一个配置。log4net文件。我已经将
放在那里,并删除了所有的appender部分。 - 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.
-
在test runner文件夹中,有一个nun. exe。配置和nunit-console.exe。配置文件——我把
放在这两个文件中。 - I can't find any config files to play with in the ants profiler folder.
- 我在ants profiler文件夹中找不到任何配置文件。
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.
通过查看配置文件结果,我可以看到log4net正在被调用,而且它肯定在调用方法来输出日志信息。
1 个解决方案
#1
2
In the test setup, get the root logger and set it's log level to OFF.
在测试设置中,获取根日志记录器并将它的日志级别设置为OFF。
#1
2
In the test setup, get the root logger and set it's log level to OFF.
在测试设置中,获取根日志记录器并将它的日志级别设置为OFF。