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])

Comments

Popular posts from this blog

Sharepoint 2007 Showing outlook Inbox using outlook active X control

IIS Configuration Error Error: Cannot write configuration file due to insufficient permissions

Java IDE for Grail Development