Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
                        jobsList.EventReceivers.Add(receiver);

                        clientContext.ExecuteQuery();

                        System.Diagnostics.Trace.WriteLine("Added ItemAdded receiver at "
                                + msg.Headers.To.ToString());
share|improve this question

1 Answer 1

up vote 5 down vote accepted

In think this blog post has it all regarding this: http://spdevlab.com/2013/12/11/go-cloud-a-better-logging-for-sharepoint-onlineoffice365azure-apps/

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

Your Answer

 
discard

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.