2011-12-17 22 views

回答

4

Pelle, RavenDB使用NLog來記錄其操作。你可以從Raven.Client配置NLOG輸出一切*到控制檯/調試,你可以用下面的配置做到這一點:

<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> 
+0

工作很好!謝謝! – Pelle

1

這只是我的頭頂。我使用Resharper和NUnit或XUnit。要獲取Resharper單元測試輸出窗口中的任何信息,我只需使用Debug.WriteLine("blah"); Works很棒。

現在RavenDb確實通過創建自己的IDocumentQueryListener我們有一些地方,你可以添加自己的定製邏輯,如Debug.WL(..) ..

因此,也許實現其中之一?

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 
} 

然後,只需註冊這個監聽器與您DocumentStore ...

documentStore.RegisterListener(new DebugWriteLineDocumentListener()); 

看看是否有幫助..

我還沒有試過..只是走進的第一件事我的頭:)

GL!保持我們的發佈!

+0

謝謝!很高興知道! – Pelle