开发者

Can WCF Logging be configured to use shell folder paths?

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开发者_如何学C" name="ServiceTrace"
      traceOutputOptions="None">
     <filter type="" />
     </add>
    </listeners>
  </source>

Any ideas most welcome..


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜