Reputation: 2785
I would like all calls made to RavenDb to be shown in the Resharper testrunner when i run my tests, is there some kind of logging or tracing that can be turned on in the client?
Upvotes: 3
Views: 317
Reputation: 22956
Pelle, RavenDB uses NLog under the covers to log its actions. You can configure NLog to output everything from Raven.Client.* to the console / debug, you can do it with the following configuration:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.netfx35.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="Console" Name="Console" />
</targets>
<rules>
<logger name="Raven.Client.*" writeTo="Console"/>
</rules>
</nlog>
Upvotes: 4
Reputation: 86957
This is just something that's off the top of my head. I use Resharper and NUnit or XUnit. To get any info in the Resharper unit test output window, I just use Debug.WriteLine("blah");
Works great.
Now RavenDb does have some places you can add your own custom logic, such as Debug.WL(..)
by creating your own IDocumentQueryListener
's ..
So maybe implement one of them?
public class DebugWriteLineDocumentListener : IDocumentQueryListener
{
#region Implementation of IDocumentQueryListener
public void BeforeQueryExecuted(IDocumentQueryCustomization queryCustomization)
{
// Do whatever you want, here.
// UnTested .. but I *think* the ToString will list the Linq query.
Debug.WriteLine(queryCustomization.ToString());
}
#endregion
}
Then just register this listener with your DocumentStore
...
documentStore.RegisterListener(new DebugWriteLineDocumentListener());
See if that helps ..
I've not tried it .. just the first thing that came into my head :)
GL! Keep us posted!
Upvotes: 1