简体   繁体   中英

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 . When I select None , there is not any log from the plugin. 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 .

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 .

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? 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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