title: System.Diagnostics.Trace in referenced Class Library project
body: <p>I have a <code>Asp.Net</code> (Web Api) project. In this project I reference another Class Library project.</p>
  
  <p>The traces that are written in the referenced Class Library don't show up in my Log.</p>
  
  <p>How can I make the traces off both projects show up in the same Log using <code>System.Diagnostics</code>? In other words, how can I make the referenced Class Library use the <code>web.config</code> Diagnostics settings from the Api Project? And if this isn't possible, how can I get the Traces that are written in the referenced Class Library in a Log at all?</p>
  
  <p>I tried to add the <code>System.Diagnostics</code> settings from the <code>web.config</code> to a <code>app.config</code> but this doesn't seem to do anything at all.</p>
  
  <p><strong>Api project:</strong></p>
  
  <pre><code>TraceSource source = new TraceSource("MyProject");
  source.TraceEvent(TraceEventType.Information, 1, "My logged Trace");
  </code></pre>
  
  <p><strong>Referenced class library:</strong></p>
  
  <pre><code>TraceSource source = new TraceSource("MyProject");
  source.TraceEvent(TraceEventType.Information, 1, "My disappearing Trace");
  </code></pre>
  
  <p><strong>Web.config</strong></p>
  
  <pre><code>&lt;system.diagnostics&gt;
    &lt;sources&gt;
      &lt;source name="MyProject" switchValue="All"&gt;
        &lt;listeners&gt;
          &lt;clear /&gt;
          &lt;add name="log" /&gt;
        &lt;/listeners&gt;
      &lt;/source&gt;
    &lt;/sources&gt;
    &lt;sharedListeners&gt;
      &lt;add name="log"
           type="System.Diagnostics.XmlWriterTraceListener"
           initializeData="Log.svclog"
      /&gt;
    &lt;/sharedListeners&gt;
    &lt;trace autoflush="true"/&gt;
  &lt;/system.diagnostics&gt;
  </code></pre>