Share via


FIM Service Troubleshooting: How to Enable Tracing

Overview

This document will provide the steps necessary to work enable FIM Service Tracing.  FIM Service Tracing is enabled/disabled via the FIM Service Configuration File ( %programfiles%\Microsoft Forefront Identity Manager\2010\Service\Microsoft.ResourceManagement.Service.Exe.Config ). 

Steps to enable FIM tracing

  1. Prior to making any changes to this file, it is very important to make a backup copy of this file.   You can do this by very simply copying, and pasting the file in the same directory, or placed into a backup directory.
  2. Once you have made the backup copy of the FIM Service Configuration File, then let's edit the FIM Service Configuration File.
    1. *NOTE* You can use editors such as Notepad, Visual Studio, or any text file editor.
  3. Set the log file location
    1. In this wiki, we will be using "C:\Logs" as the place to put our log files.  By default, "C:\Logs does not exist.  If you do not have a "C:\Logs" folder, then please create one at this time. 
      1. The FIM Service Account must have access to the folder that you are placing the trace files.
  4. Insert the messageLogging section
    1. While editing the FIM Service Configuration File, go to the top and search for the word system.serviceModel.

    2. You should end up at the XML tag <system.serviceModel>

    3. You will want to insert some spaces between the XML tag <system.serviceModel> and the tag <services>

    4. Paste the below text in between the XML tag <system.serviceModel> and the tag <services> 1.

      ```
      <diagnostics>
        <messageLogging
             logEntireMessage="true"
             logMalformedMessages="true"
             logMessagesAtServiceLevel="true"
             logMessagesAtTransportLevel="true"
             maxSizeOfMessageToLog="2147483647"/>
      </diagnostics>
      ```
      
      1. Once copied, it should look like the below:

      2. <system.serviceModel>
        <diagnostics>
           <messageLogging
              logEntireMessage="true"
              logMalformedMessages="true"
              logMessagesAtServiceLevel="true"
              logMessagesAtTransportLevel="true"
              maxSizeOfMessageToLog="2147483647"/>
        </diagnostics>
        <services>
        
  5. Update the <system.diagnostics> section
    1. While editing the FIM Service Configuration File, go to the top and search for the word system.diagnostics.

    2. You should end up at the XML tag <system.diagnostics>

    3. If you have a default FIM Service Configuration File, then you will see the <sources> tag directly under the <system.diagnostics> tag

    4. In between the <system.diagnostics> tag and the <sources> tag, paste the below section for the <switches> tag

    5. **   **

      <switches>
            <add name="System.Workflow LogToTraceListeners" value="1" />
            <add name="System.Workflow.Runtime.Hosting" value="Verbose" />
            <add name="System.Workflow.Runtime" value="Verbose" />
            <add name="System.Workflow.Runtime.Tracking" value="Verbose" />
            <add name="System.Workflow.Activities" value="Verbose" />
            <add name="System.Workflow.Activities.Rules" value="Verbose" />
          </switches>
      
    6. Once copied, it should look like:

    7. <

      system.diagnostics>
          <switches>
            <add name="System.Workflow LogToTraceListeners" value="1" />
            <add name="System.Workflow.Runtime.Hosting" value="Verbose" />
            <add name="System.Workflow.Runtime" value="Verbose" />
            <add name="System.Workflow.Runtime.Tracking" value="Verbose" />
            <add name="System.Workflow.Activities" value="Verbose" />
            <add name="System.Workflow.Activities.Rules" value="Verbose" />
          </switches>
          <sources>
      
    8. Now let's talk about the sources

      1. SOURCE: "Microsoft.ResourceManagement"
        1. Change the switchvalue from Error to "Verbose,ActivityTracing"
          1. It should look like: <source name="Microsoft.ResourceManagement" switchValue="Verbose,ActivityTracing">
        2. In this Source Tag, look for "DiagnosticListener" (e.g. <add name="DiagnosticListener">)
          1. Change DiagnosticListener to ServiceModelTraceListener
          2. It should look like: <add name="ServiceModelTraceListener">
      2. Now we need to add a few more sources.  Look for the </source> which closes the Microsoft.ResourceManagement <source> tag
      3. Copy the below section and place it after the </source> tag and before the </sources> tag
        1.      

          <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing"
                  propagateActivity="true">
                  <listeners>
                    <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                      <filter type="" />
                    </add>
                    <add name="ServiceModelTraceListener">
                      <filter type="" />
                    </add>
                  </listeners>
                </source>
                <source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing">
                  <listeners>
                    <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                      <filter type="" />
                    </add>
                    <add name="ServiceModelMessageLoggingListener">
                      <filter type="" />
                    </add>
                  </listeners>
                </source>
          

           

        2. It should look like this once copied:

        3. </source>
                <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing"
                  propagateActivity="true">
                  <listeners>
                    <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                      <filter type="" />
                    </add>
                    <add name="ServiceModelTraceListener">
                      <filter type="" />
                    </add>
                  </listeners>
                </source>
                <source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing">
                  <listeners>
                    <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                      <filter type="" />
                    </add>
                    <add name="ServiceModelMessageLoggingListener">
                      <filter type="" />
                    </add>
                  </listeners>
                </source>
          </sources>
          
      4. Now, let's talk about the <sharedListeners> tag.  We are going to replace the <sharedListeners> tag. 
        1. In the FIM Configuration File, search for the <sharedListeners> tag, and then the </sharedListeners> tag. 

        2. Highlight the entire section from <sharedListeners> to </sharedListeners>

        3. Paste the below text to relace the default <sharedListeners> section

        4. **    <sharedListeners>**

           

                <add initializeData="C:\Logs\Microsoft.ResourceManagement.Service_tracelog.svclog"

                  type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

                  name="ServiceModelTraceListener" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">

                  <filter type="" />

                </add>

                <add initializeData="C:\Logs\Microsoft.ResourceManagement.Service_messages.svclog"

                  type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

                  name="ServiceModelMessageLoggingListener" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">

                  <filter type="" />

                </add>

                <add initializeData="c:\logs\fimservice_textOutput.txt" type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

                  name="Text" traceOutputOptions="DateTime, ThreadId">

                  <filter type="" />

                </add>

          **    </sharedListeners>**

      5. Just below the </sharedListeners> tag is a commented section for <trace autoflush.
        1. Replace <!--<trace autoflush="true"/>--> with <trace autoflush="true" />
  6. Save the file

Disable tracing

If you made the backup copy of the FIM Service Configuration File, then you can rename the tracing file to Microsoft.ResourceManagement.Service.Exe.Config._TracingEnabled. Once you do that, then rename the backup copy back to Microsoft.ResourceManagement.Service.Exe.Config. If you do this, then you should be able to easily toggle back forth to enable/disable tracing.

Anytime you change the FIM Service Configuration File, then you will need to restart the FIM Service (Forefront Identity Manager Service).

Additional FIM tracing articles

See Also