Log.WriteEntry questions

E

eric.goforth

Hello,

I'm trying to write information out to a log file, I think that I'm
missing something in my app.config file. I've put the following in
there:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for
My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the
Application Event Log -->
<add name="EventLog"/>
<add name="FileLogListener" />
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"

type="Microsoft.VisualBasic.Logging.FileLogTraceListener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter" />
<!-- 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="MyApplication"/>
<add name="FileLogListener"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
initializeData="FileLogListenerWriter"
location="Custom"
customlocation="c:\" />

</sharedListeners>
</system.diagnostics>
</configuration>

In the Error list I get the following warnings in my App.config file:

The 'location' attribute is not declared.
The 'customlocation' attribute is not declared.

I've put the following in my VB.NET code:

My.Application.Log.WriteEntry("Test")

I see a c:\MyApplication.log file get created, but nothing gets written
to it. Any idea what's wrong?

Thanks,
Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top