How to specify a custom eventlog in app.config

Hello all,

I'm trying to learn about .NET configuration files. I've setup my app.config file to log to the EventLog (apparently to the application log).

I'd like to know how I can tell the configuration file to create my own custom event log instead of using the application log.

Here is my configuration file.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="DBConnectionString" connectionString="TESTSTRING"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<!-- Uncomment the below section to write to the Application Event Log -->
<add name="EventLog"/>
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="OCRTest"/>
</sharedListeners>
</system.diagnostics>
</configuration>

Thanks in advance to all replies.

[1728 byte] By [budbjames] at [2007-12-22]
# 1
Doing more research I've found a reference on goog that references My.Application.Log.EventLogName... however, I can't find it in the ms document or in inteliensese.

Any ideas?

Thanks in advance to all replies
budbjames at 2007-8-30 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 2
What version of Visual Studio are you using?
nobugz at 2007-8-30 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 3
I'm using Visual Studio 2005.

Thanks for the reply.
budbjames at 2007-8-30 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...

.NET Development

Site Classified