0

This seems like it should be quite simple, but I'm not an expert (or anywhere near) with regards to both 'frameworks' involved here.

Part of our build pipeline runs our unit tests using the nunit console runner.

We also use log4net and configure a console appender and a Rolling File Appender The console appender is useful for QA when they run the tests, so they don't have to hunt out the file. So I can't just get rid of it and I can't get rid of the file appender as that is important.

What I've noticed is that my nunit logs contain all the console output from my application (that is already being written to file) and making it very hard to parse and taking up tons of space.

Is there a way to take the console logging the NUnit test into the file and ignore the stuff coming from log4net?

Dave
  • 2,829
  • 3
  • 17
  • 44
  • 1
    How did you manage the log4net configuration? Make sense to create the separate configs for tests and the rest of application – Pavel Anikhouski Nov 27 '19 at 18:46
  • What do you mean by "nunit logs?" NUnit does have internal logs, but they shouldn't contain your console output. Console output from tests is stored as a part of the xml test result and is also written to console by the console runner, but only if you request it to be written. – Charlie Nov 27 '19 at 22:30
  • It sounds like the "NUnit logs" are a capture of the console output from the test run? If so, I agree with Pavel--you should disable log4net's console appender when running your NUnit tests. – xander Nov 28 '19 at 03:47
  • Hello all, thanks for taking the time to ask questions. All we are doing is passing in an argument of a file name to write the logs to file, the resulting logs, have the test results and test logging, intertwined with our application logs (which I don't want). Any thoughts on where I can begin finding out how to turn off a logger when running tests? – Dave Nov 28 '19 at 09:35

0 Answers0