Free Jobs
Reference




Dot Net Forums: ASPNET (77) C#.NET (39) VB.NET (8) AJAX (21) Silver Light (1) WCF (10) WPF (1) WWF (1) .NET 3.5 (3) SQL SERVER (38) Other (3)

Topic: What is integrated Logging mechanism in WCF and its advantages

To get the Posted Questions details daily in your mail Click Here

Share this Post on Facebook/Twitter/Orkut Bookmark and Share





User: dhiraj5079 Post Date: 03 Feb 2012 10:50

Introduction:
What is integrated Logging mechanism in WCF and its advantages



Main Content:
   WCF has an integrated Logging mechanism that enables us to log traces

    without writing code for it.

   The integrated logging can be enbaled for wcf service

   in the following two step changes in Web.config

   A)Enable message logging in WCF :Below is the system.serviceModel part of web.config

  that is used to enable message logging in WCF.

  <system.serviceModel>

   <diagnostics>  

   <messageLogging 

         logEntireMessage="true"   

         logMalformedMessages="true"

         logMessagesAtServiceLevel="true"

         logMessagesAtTransportLevel="true" 

         maxMessagesToLog="100000"     

         maxSizeOfMessageToLog="100000"/>

   </diagnostics>

</system.serviceModel>

  B)Enable ASP.NET tracing for WCF

    To enable ASP.NET tracing in web.config to use integrated Logging mechanism in WCF

  write the following in the web.config file.

  <system.diagnostics>

    <sources>

     <source name="System.ServiceModel"

     switchValue="Information, ActivityTracing"  propagateActivity="true">

         <listeners>  

        <add type="System.Diagnostics.DefaultTraceListener" name="Default">

          <filter type="" />

        </add>

        <add name="ServiceModelTraceListener">

          <filter type="" />

        </add>

        </listeners>  

   </source>

</sources>    

  <sharedListeners>

    <add initializeData="app_tracelog.svclog"

      type="System.Diagnostics.XmlWriterTraceListener, System,

     Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

        name="ServiceModelTraceListener" traceOutputOptions="Timestamp">

      <filter type="" />

    </add>

  </sharedListeners>

</system.diagnostics>



After setting the above configuration

the trace will be written in the

app_tracelog.svclog file that is located in

folder where WCF service concerned is hosted.

Conclusion:
This is integrated Logging mechanism in WCF.



About Writer:
Hi,I am IT Professional From Mumbai


Writer's Link: http://

Writer's Email:







Comments:
Post Comment





Similar Articles Top ArticlesLatest Articles Other Articles by this Author







www.freejobsreference.com Copyright © 2009-2011 | All Rights Reserved
All content of this website is protected by copyright laws and should not be reproduced in any form or by any means without written permission
(Best viewed in IE 8.0+ or Firefox 3.0+ at resolution of 1024 * 768 or higher)