10

Actually, recommended practice would be to use a Namespace as your logger, as opposed to new object() or anything else. Just using "YourLoggerName" would not be flexible enough to allow admins to fine tune log handling inside your module. As you rightly point out, this will not work in a static class. But this will: Sitecore.Diagnostics.Log.Error("Message"...


7

The error handling for Sitecore 9 is the same as Sitecore 8.x For me, I like to have my error pages as html pages so that it wont cause a loop if I have a serious issue. Here I remove all the existing code and add my new ones to my custom html files. Web.config <system.webServer> <httpErrors errorMode="Custom" existingResponse="Auto"> ...


6

The Pipeline solution is for the core Sitecore or non-SXA sites. In SXA you can set the pages directly by putting/selecting the pages with its out of the box feature. This is how you do it. Create the page/pages for not found and internal server error page, you can even style it as per you design. Assign those page in your settings, by selecting the ...


6

Assign 404 and 505 pages in your settings, by selecting the relevant pages by going /sitecore/content/{Environment}/{DemoSXASite}/Settings/ in the "Error Handling section" For the 500 page you have to do a little trick, once you have designed the pages completely. go to /sitecore/content/{Environment}/{DemoSXASite}/Settings/Site Grouping/DemoSXASite Select ...


5

You certainly could, but it requires a couple moving parts: Track the pages when they are deleted so you can look them up later To know whether a requested URL used to exist or not, you'll need to track pages as they're deleted so you can check that list later. You'll need an item:deleted event handler: public class PageDeletionLogger { public void ...


4

I worked with @sitecorepm on Slack to run a few tests. Why It Fails If Sitecore has not been previously initialized the custom error page will not appear. Failed Test Using Habitat 9.1.0 Stop SQL Server Reset IIS View site You will receive the generic IIS Runtime Error page, even with <customErrors> set to "On". Successful Test Using Habitat 9.1....


2

Is there actually a "problem"? The log warning is just telling you that someone tried to browse to /login.aspx (which apparently doesn't exist on your site, which is fine), and Sitecore responded with its normal default behavior (redirecting to "404" page). You can repro this yourself by browsing to /login.aspx on your site and see what happens. These log ...


2

Akshay we do something similar to this (for a different use case to 500 errors) but instead of publishing out actual pages we instead write Json files out to the server which store the content for the page. The content of these files are managed in Sitecore under a settings item and then on publish of the item the Json file is created (pre-fixed with the ...


2

For the case of Error 403 - This web app is stopped. - this is not easily possible since it is actually the built-in Azure load balancer that is serving the error, not the WebApp or Sitecore. You can track the status of this feature on Azure Feedback portal and vote for it. There is a possible workaround: you can route all traffic to your WebApp via your ...


1

TL;DR Change this line of code in the CustomExecuteRequest: var notFoundUrl = _baseLinkManager.GetItemUrl(notFoundItem); To this: var notFoundUrl = _baseLinkManager.GetItemUrl(notFoundItem, new Sitecore.Links.UrlOptions { AlwaysIncludeServerUrl = false }); var extractedLanguageName = WebUtil.ExtractLanguageName(notFoundUrl); if (!...


1

There is now official documentation for this available here. However I will extend it with some extra steps that I think are needed. I've tested with 9.0.2 and SXA 1.7.1, as well as with 9.1.0 and SXA 1.8.0 on Azure PaaS. Create your error page item. Publish the error page item. Navigate to sitecore/Content/Tenant/Site/Settings and in the Error Handling ...


1

thank you for this article. I Created a 404 page as you mentioned and added some component to customize content displayed. I disabled the processor to override Sitecore's default 404. I set also ItemNotFoundUrl <setting name="ItemNotFoundUrl" value="/404" /> In web.config I didn't added any specific configuration in section customErrors and ...


1

You need to set the absolute path of the image in your error page, for example: <body> <img src="/assets/images/errors/errorImage.png"> </body> The reason the image works when you load the page directly in the browser is because the (I presume) the htm and image are located in the same folder, and therefore the image is correctly ...


1

You can also make use of a string for the object parameter as shown below: Sitecore.Diagnostics.Log.Error("Message", ex, "YourLoggerName"); The loggerName is the module or feature. For example, you are using the Log.Error in the module Product, you can set the loggerName as Product. This can be useful when you see the errors with the logger as Product, ...


Only top voted, non community-wiki answers of a minimum length are eligible