Sharepoint Workflows / ASP.NET - Logging using diagnostic traceing
One of the coolest feature in asp.net is its tracing. Good thing is that it can be utilized in sharepoint as well and provide an easy way for logging inside workflow foundation.
You just need to add following in you sharepoint web.config file
<system.diagnostics>
<switches>
<add name="System.Workflow LogToTraceListeners" value="1" />
<add name="System.Workflow.Runtime.Hosting" value="Verbose" />
<add name="System.Workflow.Runtime" value="Verbose" />
<add name="System.Workflow.Runtime.Tracking" value="Verbose" />
<add name="System.Workflow.Activities" value="Verbose" />
<add name="System.Workflow.Activities.Rules" value="Verbose" />
<add name="[Your namespace]" value="Verbose" />
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\Output.log" />
</listeners>
</trace>
</system.diagnostics>
and use following command in your code for sending log to your file for your logging
System.Diagnostics.Trace.WriteLine([message])
You just need to add following in you sharepoint web.config file
<system.diagnostics>
<switches>
<add name="System.Workflow LogToTraceListeners" value="1" />
<add name="System.Workflow.Runtime.Hosting" value="Verbose" />
<add name="System.Workflow.Runtime" value="Verbose" />
<add name="System.Workflow.Runtime.Tracking" value="Verbose" />
<add name="System.Workflow.Activities" value="Verbose" />
<add name="System.Workflow.Activities.Rules" value="Verbose" />
<add name="[Your namespace]" value="Verbose" />
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\Output.log" />
</listeners>
</trace>
</system.diagnostics>
and use following command in your code for sending log to your file for your logging
System.Diagnostics.Trace.WriteLine([message])
Comments
Post a Comment