Rastreamento .NET não funciona com Diagnostics.TraceSource, apenas Diagnostics.Trace

Estou tentando configurar o rastreamento .NET. Sou capaz de obter o rastreio básico para trabalhar via System.Diagnostics.Trace, mas por motivos complicados, tenho que ativar o rastreamento através dos objetos System.Diagnostics.TraceSource (a nova maneira de fazer isso, desde o .NET 2.0), em vez de usar o System .Diagnostics.Trace. Eu tentei de tudo, mas ele simplesmente não quer trabalhar usando o TraceSource. Estou executando o rastreamento em um asp.net code-behind (aspx.cs)

Aqui estão alguns URLs relacionados:

http://msdn.microsoft.com/en-us/library/ty48b824.aspx
http://msdn.microsoft.com/en-us/library/64yxa344.aspx
http://msdn.microsoft.com/en-us/library/sk36c28t.aspx
http://blogs.msdn.com/b/bclteam/archive/2005/03/15/396431.aspx
http://msdn.microsoft.com/en-us/library/b0ectfxd%28v=VS.100%29.aspx

Atualmente, com base no conteúdo do web.config, ele deve ser rastreado para um arquivo e para a página, a partir deste código:

TraceSource ts = new TraceSource("mysource", SourceLevels.All);
Trace.Write("Trace (old way)"); // this one works
ts.TraceInformation("Trace (new way)"); // this one doesn't work
ts.Flush();
ts.Close();

Aqui estão as seções web.config relevantes:

 <system.diagnostics>
       <trace autoflush="false">
            <listeners> <!-- these listeners activate the "old way" of tracing. -->
                 <add       name="pagelistener" />
                 <add       name="filelistener" />
            </listeners>
       </trace>

       <sources>
            <source name="mysource" switchName="myswitch">
                 <listeners>  <!-- these listeners activate the "new way" -->
                       <add name="pagelistener" />
                       <add name="filelistener" />
                 </listeners>
            </source>
       </sources>


       <sharedListeners> 
            <!-- these are the actual trace listeners -->
            <add
                  name="filelistener"
                 type="System.Diagnostics.TextWriterTraceListener"
                 initializeData="loplog.txt"
                 />
            <add
                 name="pagelistener"
                 traceOutputOptions="none"
                 type="System.Web.WebPageTraceListener, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                 />
       </sharedListeners>

       <switches>
            <!-- the sources above use this verbose switch -->
            <add name="myswitch" value="Verbose"/>
       </switches>

 </system.diagnostics>
 <system.codedom>
       <!-- this compilers section should not be needed because I added
                 #define TRACE to the .aspx.cs file, however I put this in
                 since it's still not working. -->

       <compilers>
            <compiler
                            language="c#;cs;csharp"
                            extension=".cs"
                            compilerOptions="/d:TRACE"
                            type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                            warningLevel="1"
                            />
       </compilers>
 </system.codedom>

 <system.web>
       <!-- this trace tag should be redundant because I added trace="true" to the aspx file,
                 but I put it in here anyway because this wasn't working. -->
       <trace writeToDiagnosticsTrace="true" enabled="true" pageOutput="true" requestLimit="50" localOnly="true"/>

questionAnswers(1)

yourAnswerToTheQuestion