Few months ago I posted about enabling log and trace information for PnP Core Provisioning when using Console Application.
Recently, I have been working in several projects with PnP Partner Pack Provisioning and some custom Web Jobs using PnP Core Provisioning bits as well. And there is one annoying thing in common, not having PnP Provisioning Logs!! So, sometimes we are blind and we don’t exactly know what is going on with the Site Creation.
This post is about Enable PnP Provisioning Invocation or Function Logs when using your custom Web Job or using PnP Partner Pack.
When I mention Invocation / Function Logs that is what I mean:
Note: In order to enable these logs, you should configure AzureWebJobsDashboard setting in the Azure Web App settings. IMPORTANT, it need to be in the UI, is not valid to have it on web.config only.
In my opinion it is important enable logs at this level because:
Invocation-Scoped Log. Every Site Creation will have its own log.
One URI per log as well in the format: https://
Let’s see how to configure it.
Create a new custom
TextWriter log (
ProcessQueueMessage one) and connect it to Trace listener previously configured.
I highly recommends to add the custom
TraceFilter as well because a side effect of enable all Trace events is that we will be receiving tons of TokenCache and AcquireTokenHandlerBase Information logs and these will be annoying. In fact, it will be difficult to find the PnP logs among these ones:
OfficeDevPnP.PartnerPack.ContinousJob.exe Information: 0 : 02/16/2017 14:50:11: ab5a77a1-c3d7-4211-9f8b-22d3915163ae - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
So, in the below code you can see how to create custom
RemoveWordsFilter and how to use it in the
These are the results: