1

This is my fist attempt to get tracing up and running in a multi-class application. The examples I've followed and had success with aren't translating to the app I need to trace. I've read up on SO, MSDN and elsewhere, still missing something. Here's a snip of the code that's not generating anything in logs:

Imports System.Windows.Forms
Imports Inventor
Imports System.Runtime.InteropServices
Imports tankBuilder.MainForm
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System

Namespace tankBuilder
    <ProgIdAttribute("singleCourseMasterTank.StandardAddInServer"), _
    GuidAttribute("70f8dedc-4ae1-4bb9-be6b-c275afcd1333")> _
    Public Class StandardAddInServer
    Implements Inventor.ApplicationAddInServer
    Friend Shared PI As Double = 3.14159
    Friend Shared Tracer As New TraceSource("TraceSource1")
    ... logic...
Tracer.TraceInformation("Informational message.")
Tracer.TraceEvent(TraceEventType.Error, 1, "Error message.")
Tracer.TraceEvent(TraceEventType.Warning, 2, "Warning message.")

Here's the corresponding section from app.config

<system.diagnostics>
   <sources>
     <source name="TraceSource1"
       switchName="sourceSwitch"
       switchType="System.Diagnostics.SourceSwitch">
       <listeners>
         <add name="console"
           type="System.Diagnostics.ConsoleTraceListener">
           <filter type="System.Diagnostics.EventTypeFilter"
             initializeData="Error"/>
         </add>
         <add name="prodListener"
           type="System.Diagnostics.TextWriterTraceListener"
           initializeData="C:\Data\Projects\trace.log">
         </add>
         <remove name="Default"/>
       </listeners>
     </source>
   </sources>
   <switches>
     <add name="sourceSwitch" value="4"/>
   </switches>
</system.diagnostics>

Thanks so much in advance!

--EDIT: I just noticed that my project is a library/dll project. Not sure if that makes a difference.

0 Answers0