简体   繁体   English

CRM 插件跟踪日志 - 仅用于沙盒模式的日志

[英]CRM Plug-in Trace Log - logs only for sandbox mode

I have this very simple plugin我有这个非常简单的插件

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

but the log is tracked only when the plugin is registered in Sandbox .但仅当插件在Sandbox中注册时才会跟踪日志。 When I select None , there is not any log from the plugin.当我 select None时,插件没有任何日志。 I've already found some threads about this problem, but no solution.我已经找到了一些关于这个问题的线程,但没有解决方案。 Thanks for any help.谢谢你的帮助。

You might have seen this community thread , many users are affected by this behavior.您可能已经看过这个社区线程,许多用户都受到这种行为的影响。 That may be the intended behavior by Microsoft .这可能是Microsoft 的预期行为

See the comments from code sample :请参阅代码示例中的注释:

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

But interestingly MS documentation conflicts with that .但有趣的是 MS 文档与.

Tracing is supported for sandboxed (partial trust) and full trust registered custom code and during synchronous or asynchronous execution.沙盒(部分信任)和完全信任注册的自定义代码以及同步或异步执行期间支持跟踪。

Probably this idea will make the change, vote for it.可能这个想法会做出改变,投票给它。

Do you get a trace log when you register in None mode and there is an error?当您在 None 模式下注册并且出现错误时,您是否会收到跟踪日志? I have, sadly, had to throw Exceptions in my plugin code before to get a log file generated to see what is going on.遗憾的是,我不得不在我的插件代码中抛出异常,才能生成一个日志文件以查看发生了什么。

Not sure if that helps.不确定这是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM