I like to fill my test code with TONS of logging. I log damn near everything because I hate it when the team has to waste time answering, “Can you get me a repro?” when we can just peruse the logs to see what went wrong. I also like to watch the traces get logged in real time using DebugView as my tests execute. So after I made some recent changes in my code to programmatically manage our AppFabric cache, I was super bummed to see my real time logging completely disappear.
The following code shows a snippet of what my test code is doing to repro the issue:
The traces simply no longer get output to the default trace listener. Sure, if I setup a text file listener in my app.config, the traces are properly logged to the file. But what fun is that? I need this stuff in real time now, not after my 100 or so tests run.
So I posed this question to @drub0y, Mimeo’s Chief Software Architect. Sure enough minutes later he responded with:
Well damn. JustDecompile to the rescue. Let’s see how we could have done this ourselves.
- Fire up JustDecompile, and then load %PROGRAMFILES%\AppFabric 1.1 for Windows Server\Microsoft.ApplicationServer.Caching.Core.dll to the assembly list.
- Click on the Search button
- Go to the Full Text tab and enter: “Listeners”
You should then get a single hit:
And sure enough, when you double click on that, you get the code that @drub0y sent me in the mail above.
The fix? Easy. I just had to add a simple Trace.Listeners.Add(“DefaultTraceListener”) in my code after invoking the powershell pipeline.