【问题标题】:CRM Plug-in Trace Log - logs only for sandbox modeCRM 插件跟踪日志 - 仅用于沙盒模式的日志
【发布时间】:2019-09-20 09:52:17
【问题描述】:

我有这个非常简单的插件

 public class TestPlugin : IPlugin
  {
    public void Execute(IServiceProvider serviceProvider)
    {
      ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
      tracingService.Trace("HelloWorld");
    }
  }

但仅当插件在Sandbox 中注册时才会跟踪日志。当我选择None 时,插件中没有任何日志。 我已经找到了一些关于这个问题的线程,但没有解决方案。 感谢您的帮助。

【问题讨论】:

    标签: c# logging plugins dynamics-crm crm


    【解决方案1】:

    您可能已经看到this community thread,许多用户都受到此行为的影响。那可能是the intended behavior by Microsoft

    code sample的cmets:

    //Extract the tracing service for use in debugging sandboxed plug-ins.
    ITracingService tracingService =
        (ITracingService)serviceProvider.GetService(typeof(ITracingService));
    

    但有趣的是MS documentation conflicts with that

    沙盒(部分信任)和完全信任注册的自定义代码以及同步或异步执行期间支持跟踪。

    可能this idea 会做出改变,投票给它。

    【讨论】:

      【解决方案2】:

      当您在无模式下注册并出现错误时,您是否会收到跟踪日志?遗憾的是,我不得不在我的插件代码中抛出异常才能生成日志文件以查看发生了什么。

      不确定这是否有帮助。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-06-27
        • 1970-01-01
        • 2011-08-09
        • 2014-06-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多