Event Logging from a WCF Service RRS feed

  • Question

  • Hi,

    I'm trying to call a DLL from my WCF service. I know that the service connectivity is working, as I have witnessed a simple string manipulation being done by the service and displayed by the client.

    I am now trying to perform some more complex functions within the WCF service, which require the use of a third party DLL. That call to the DLL is failing. I am receiving a somewhat non-descript error from the client application, as would be expected - but I am struggling to get the WCF service to log anything decent to help me with the fault.

    I've added the following code into the service's web.config, but I am still seeing nothing in the event logs. Can anyone suggest another way to enhance my debugging potential please?

        <trace autoflush="true">
            <remove name="Default" />
            <clear />
            <add name="EventLogListener" type="System.Diagnostics.EventLogTraceListener"
                                initializeData="ValidateSvc" />
          <add name="General" value="4" />
          <!--  Off Error Warning Info Verbose. Should be set to Error for production!!
          0 (off), 1 (error), 2 (warning), 3 (info), OR 4 (verbose)



    Cheers, John

    Wednesday, June 17, 2015 10:12 PM

All replies

  • hi John,
       As per this case, you can modify the switch value in source tag based on your tracing like below :

    <configuration >
          <source name="EventLogTraceSource" switchValue="Verbose">
              <add name="EventLogListener">
    <add name="EventLogListener" type="System.Diagnostics.EventLogTraceListener" />
        <trace autoflush="true" />

    for more information, refer the following link :
    1. Click here to refer about Configuring Tracing & its Trace level.

    2. Click here to refer about similar thread explained about logging to eventlog

    Thursday, June 18, 2015 3:54 AM
  • Hi Edwin,

    I confess I am still lost. I've now spent a good couple of hours trying out various things, but I am still seeing nothing from my service appearing in the logs. I have tried enabling some Analytic and Debug logs - my web server locked me out for a few minutes when I did that.

    I have the code you suggested above in my web.config file, and in the service.vb module, I have:

    Public Class Service
        Implements IService
        Public Overloads Shared Sub Main(args() As String)
            ' Create a trace listener for the event log. 
            Dim myTraceListener As New EventLogTraceListener("EventLogTraceSource")
            ' Add the event log trace listener to the collection.
            ' Write output to the event log.
            Trace.WriteLine("Test output")
        End Sub

    I've tried various other things - like suggestions on the MSDN pages to output to an XML file at C:\log\trace.svclog - but nothing ever seems to happen.


    Cheers, John

    Thursday, June 18, 2015 11:12 PM