tags:

views:

18

answers:

1

Hello, We are trying to configure WCF Message and Trace logging to be written to a one of the shell folder paths. For example .. %ALLUSERSPROFILE%\CompanyName\logs\ServiceTrace.svclog If I enter the full path to this location it works, if I enter the above nothing appears. (I've pre-created the directories)

Example config snippet is:

<source name="System.ServiceModel" switchValue="Verbose" propagateActivity="true">
    <listeners>
     <add type="System.Diagnostics.DefaultTraceListener" name="Default">
     <filter type="" />
     </add>
     <add initializeData="%ALLUSERSPROFILE%\Company Name\logs\ServiceTrace.svclog"
      type="System.Diagnostics.XmlWriterTraceListener" name="ServiceTrace"
      traceOutputOptions="None">
     <filter type="" />
     </add>
    </listeners>
  </source>

Any ideas most welcome..

+1  A: 

The .NET trace listeners don't expand environment variables. You could probably find extended version of tracelistenders or wrappers for the standard tracelisteners that do the expansion.

Or if you control the WCF service you could add the tracelisteners programatically.

crtracy
Thanks CrTracy.. will look at extending the XmlWriterTraceListener so it does then. We like the config file for the flexibility in enabling the logging too much to push it back into code.
Cavey