If I am using a provider hosted app with the code below, its not clear to me how can I monitor logs, provider hosted apps runs in this case in a separate iis site, correct?

The System.Diagnostics line where does it log to? ULS? IIS Logs? Event Logs?

I am trying to know a good approach to debugging apps once they are in production. Specially if each app is different iis site

What other options do I have to the System.Diagnostics line?

EventReceiverDefinitionCreationInformation receiver =
                            new EventReceiverDefinitionCreationInformation();
                        receiver.EventType = EventReceiverType.ItemAdded;

                        //Get WCF URL where this message was handled
                        OperationContext op = OperationContext.Current;
                        Message msg = op.RequestContext.RequestMessage;

                        receiver.ReceiverUrl = msg.Headers.To.ToString();

                        receiver.ReceiverName = RECEIVER_NAME;
                        receiver.Synchronization = EventReceiverSynchronization.Synchronous;

                        //Add the new event receiver to a list in the host web


                        System.Diagnostics.Trace.WriteLine("Added ItemAdded receiver at "
                                + msg.Headers.To.ToString());

1 Answer 1


In think this blog post has it all regarding this: http://sharepoint-community.net/m/blogpost?id=6614983%3ABlogPost%3A66076

The basic idea is to use one of the many existing logging frameworks that are not SharePoint specific. Since a provider hosted app has no access to SharePoint logs, we have to create and use or own logs.

LogEntries seems like a good framework with many possibilities (have not tested it my self).

Your System.Diagnosics.Trace.Write will only output your logging to subscribed listeners (example being a debugging session in Visual Studio)

  • Link not working.
    – Ali
    May 30, 2016 at 2:19
  • New link added! May 30, 2016 at 4:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.