Wednesday, March 02, 2011

Enable Tracing for Console Application

For enabling Tracing you need to put following settings in app.config.

<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="myListener" type="System.Diagnostics.EventLogTraceListener" initializeData="Solstice" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>

NOTE - "ApplicationName" should be available in registry. We can use following lines to create Registry for "ApplicationName" (copy below text in notepad and save it with extension .reg and run it)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\ApplicationName]
"EventMessageFile"=hex(2):63,00,3a,00,5c,00,57,00,49,00,4e,00,44,00,4f,00,57,\
00,53,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,2e,00,\
4e,00,45,00,54,00,5c,00,46,00,72,00,61,00,6d,00,65,00,77,00,6f,00,72,00,6b,\
00,5c,00,76,00,32,00,2e,00,30,00,2e,00,35,00,30,00,37,00,32,00,37,00,5c,00,\
45,00,76,00,65,00,6e,00,74,00,4c,00,6f,00,67,00,4d,00,65,00,73,00,73,00,61,\
00,67,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,00,00


Codebehind ---- You can write Trace info as below

System.Diagnostics.Trace.TraceInformation("Writing Trace Information");

1 comment:

Anonymous said...

While calcium carbonate is not harmful to the ocean (it's even produced by microscopic shellfish and deposited on the sea floor when they die), the continued mining and extracting processes to produce calcium hydroxide for this task only work to diminish its effects.. [url=http://www.mulberryhandbagssale.co.uk]Mulberry handbags[/url] After you pay one-time charges, we give you access to download Waiting for Superman and movie of other successful Movies, easily and safely as well.. [url=http://www.goosecoatsale.ca]canada goose down coat[/url] Yobyxkokp
[url=http://www.pandorajewelryvip.co.uk]cheap pandora[/url] Vmbhujfmx [url=http://www.officialcanadagooseparkae.com]canada goose toronto factory[/url] vzaeyswzg