Wednesday, November 8, 2017

.NET Core Unit Tests–Enable logging

I noticed that .NET Core Unit Tests capture the output send through tracing (via Trace.Write()) and through the console (via Console.Write()).

It took me some time before I had the correct code to get the Microsoft.Extensions.Logging data written to my test logs.

So here is a small code snippet in case you don’t want to search for it yourself:

Remark: Don’t forget to include the Microsoft.Extensions.Logging.Console nuget package.

No comments: