SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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());
share|improve this question
up vote 6 down vote accepted

In think this blog post has it all regarding this:

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)

share|improve this answer
Link not working. – Shafaqat Ali May 30 at 2:19
New link added! – Robert Lindgren May 30 at 4:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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