none
Trace Source and Trace Listener at Runtime RRS feed

  • Question

  • <system.diagnostics> 
        <sources> 
          <source name="System.ServiceModel" 
          switchValue="Information, ActivityTracing" 
          propagateActivity="true">  
            <listeners> 
              <add name="console" /> 
            </listeners> 
          </source> 
          <source name="System.ServiceModel.MessageLogging" 
          switchValue="All">  
            <listeners> 
              <add name="console"/>  
            </listeners> 
          </source> 
        </sources> 
        <sharedListeners> 
          <add name="xml" 
          type="System.Diagnostics.XmlWriterTraceListener" 
           initializeData="d:\temp\Traces.svclog" /> 
          <add name="console" type="System.Diagnostics.ConsoleTraceListener"/>  
        </sharedListeners> 
        <trace autoflush="true"/>  
      </system.diagnostics> 

    1. is it possible with c# at runtime all of settings.
    2. is it possible a trace listener(s) (like System.ServiceModel) stop or start.
    Wednesday, October 8, 2008 7:28 PM

All replies

  • I don't know if you have seen this, but a few things can be updated:
     

    (http://msdn.microsoft.com/en-us/library/ms228993(VS.80).aspx):

    Trace Source: You can use a different TraceSource at runtime

    1. Switch value

    Trace Listeners. Though the property of the listener can be modified, it is not possible to change the listeners.

    1. Name
    2. Output options
    3. Filtering options
    Wednesday, October 8, 2008 10:18 PM
  • I want control listener specially on System.ServiceModel, start and stop System.ServiceModel listeners at runtime.
    Thursday, October 9, 2008 7:08 AM
  • I know that you've probably already answered your question, but I was looking for how to set up TraceSource and TraceListeners at runtime too.  I found this:
    http://msdn.microsoft.com/en-us/library/ms228984.aspx

    So, to answer your first question: Yes, you can do it at runtime, without a config (see the linked page)

    I'm sure that you've found an answer for your second question.

    Wednesday, September 23, 2009 5:11 PM