Frage

I am trying trace a LINQPad script. I have setup System.Net tracing according to http://msdn.microsoft.com/en-us/library/ty48b824.aspx.

I have put following lines into the LINQPad.exe.config file:

  <system.diagnostics>
    <sources>
      <source name="System.Net" tracemode="includehex" maxdatasize="1024">
        <listeners>
          <add name="System.Net"/>
        </listeners>
      </source>
      <source name="System.Net.Sockets">
        <listeners>
          <add name="System.Net"/>
        </listeners>
      </source>
      <source name="System.Net.Cache">
        <listeners>
          <add name="System.Net"/>
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="System.Net" value="Verbose"/>
      <add name="System.Net.Sockets" value="Verbose"/>
      <add name="System.Net.Cache" value="Verbose"/>
    </switches>
    <sharedListeners>
      <add name="System.Net"
        type="System.Diagnostics.TextWriterTraceListener"
        initializeData="network.log"
      />
    </sharedListeners>
    <trace autoflush="true"/>
  </system.diagnostics>

The network.log file is created. It contains the logs from the LINQPad version check:

System.Net Verbose: 0 : [1220] WebClient#3359025::DownloadString(http://www.linqpad.net/updates40/version.txt)
System.Net Verbose: 0 : [1220] WebClient#3359025::DownloadData(http://www.linqpad.net/updates40/version.txt)
System.Net Verbose: 0 : [1220] WebRequest::Create(http://www.linqpad.net/updates40/version.txt)
System.Net Verbose: 0 : [1220] HttpWebRequest::HttpWebRequest(http://www.linqpad.net/updates40/version.txt)
...

However after running the LINQPad script that is using a WebRequest to download a url, this request is not logged.

Why the LINQPad scripts are not logged? Is it possible to log them? If so, how?

War es hilfreich?

Lösung

Use LinqPad.config rather than Linqpad.exe.config

From http://www.linqpad.net/FAQ.aspx

I'm referencing a custom assembly that reads settings from an application configuration file (app.config). Where should I put my application config file so that LINQPad queries will pick it up?

Into a file called linqpad.config. This is explained in detail here.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top