Closed PhilDye closed 6 years ago
The current code contains a breaking change, because the previous public constructor public MultiUrls(string propertyData)
is removed. This could easily be fixed by making the requestingUrl
optional: public MultiUrls(string propertyData, string requestingUrl = null)
.
It could also throw a NullReferenceException
if PublishedContentRequest
or even the Uri
is null
. This could be fixed by using the null-conditional operator: UmbracoContext.Current.PublishedContentRequest?.Uri?.ToString()
.
However: with this implementation, the URL must be retrieved and converted to a string on every initialization/call, even without deleted nodes! So why not only do this when the warning needs to be logged instead?
Thanks for the PR and sorry for the late reply.
As mentioned by @ronaldbarendse it's a breaking change since someone might use the constructor.
I would suggest adding %aspnet-request{HTTP_HOST}%aspnet-request{PATH_INFO}
to the conversionPattern in the log4net.config, it will log the request url (if available) to every lentry in the log files.
e.g:
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value=" %date [P%property{processId}/D%property{appDomainId}/T%thread] %-5level %logger (%aspnet-request{HTTP_HOST}%aspnet-request{PATH_INFO}) - %message%newline" />
</layout>
"Fix" for #42. Unfortunately there isn't any more info available about which property is causing the warning.
I have a similar fix for 1.3.2, but would need a branch to PR it to.