如何在Xrm工具工具包中为CrmServiceClient启用日志记录? [英] How do you enable logging for CrmServiceClient in the Xrm Tooling toolkit?

查看:99
本文介绍了如何在Xrm工具工具包中为CrmServiceClient启用日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试使用最新版本的Xrm Tooling nuget包(使用来自自定义Powershell cmdlet的连接字符串构造函数)登录到CRM Online组织时遇到问题。

I'm having issues trying to log in to a CRM Online organization through the use of the latest version of the Xrm Tooling nuget package using the connection string constructor from a custom powershell cmdlet.

我收到了相当无助的无法登录到Dynamics CRM错误消息,并尝试启用跟踪以进行故障排除,但无法通过如下所示的.dll.config文件进行修改来启用它(取自GitHub上的XrmToolbox问题):

I'm receiving a rather unhelpful "Unable to Login to Dynamics CRM" error message and am attempting to enable tracing to troubleshoot but have not been able to enable it by modifying the .dll.config file like the below (taken from an XrmToolbox issue on GitHub):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="Microsoft.Xrm.Tooling.Connector.CrmServiceClient"
              switchName="Microsoft.Xrm.Tooling.Connector.CrmServiceClient"
              switchType="System.Diagnostics.SourceSwitch">
        <listeners>
          <add name="console" type="System.Diagnostics.DefaultTraceListener" />
          <remove name="Default" />
          <add name ="fileListener" />
        </listeners>
      </source>

      <source name="Microsoft.Xrm.Tooling.CrmConnectControl"
              switchName="Microsoft.Xrm.Tooling.CrmConnectControl"
              switchType="System.Diagnostics.SourceSwitch">
        <listeners>
          <add name="console" type="System.Diagnostics.DefaultTraceListener" />
          <remove name="Default" />
          <add name ="fileListener" />
        </listeners>
      </source>
    </sources>
    <switches>
      <!--
            Possible values for switches: Off, Error, Warning, Info, Verbose
                Verbose:    includes Error, Warning, Info, Trace levels
                Info:       includes Error, Warning, Info levels
                Warning:    includes Error, Warning levels
                Error:      includes Error level
        -->
      <add name="Microsoft.Xrm.Tooling.Connector.CrmServiceClient" value="Verbose" />
      <add name="Microsoft.Xrm.Tooling.CrmConnectControl" value="Verbose" />
      <add name="Microsoft.Xrm.Tooling.WebResourceUtility" value="Verbose" />
    </switches>
    <sharedListeners>
      <add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="XRMToolingLogs.log" />
      <!--<add name="eventLogListener" type="System.Diagnostics.EventLogTraceListener" initializeData="XRMTooling" />-->
    </sharedListeners>
  </system.diagnostics>
</configuration>


推荐答案

我能够通过配置侦听器来解决此问题通过编程方式通过:

I was able to work around this by configuring the listener programmatically through:

Microsoft.Xrm.Tooling.Connector.TraceControlSettings.TraceLevel = System.Diagnostics.SourceLevels.All;
Microsoft.Xrm.Tooling.Connector.TraceControlSettings.AddTraceListener(new TextWriterTraceListener("log.txt"));

我指出了实际错误,即CrmServiceClient期望使用具有组织唯一名称的URL而不是网址名称。

Which pointed me to the actual error which was that the CrmServiceClient was expecting a URL with the organization unique name instead of the URL name.

这篇关于如何在Xrm工具工具包中为CrmServiceClient启用日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆