0

My code is below. The Log.Info functions are being called and writing to the log on my CM box. But, nothing is being logged on the CD servers.

Sitecore 8.1 Update 3

XML Code:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <events timingLevel="custom">
      <event name="publish:end">
        <handler type="Sitecore.Modules.SitemapXML.SitemapHandler, Sitemap.XML" method="RefreshSitemap" />
      </event>
      <event name="publish:end:remote">
        <handler type="Sitecore.Modules.SitemapXML.SitemapHandler, Sitemap.XML" method="RefreshSitemap" />
      </event>
    </events>
  </sitecore>
</configuration>

C# Code:

using Sitecore.Diagnostics;
using System;

namespace Sitecore.Modules.SitemapXML
{
    public class SitemapHandler
    {
        public void RefreshSitemap(object sender, EventArgs args)
        {
            Log.Info("SitemapXML Module - RefreshSitemap Function Has Been Started", this);

            SitemapManager sitemapManager = new SitemapManager();
            sitemapManager.SubmitSitemapToSearchenginesByHttp();
            //sitemapManager.RegisterSitemapToRobotsFile();


            Log.Info("SitemapXML Module - RefreshSitemap Function Has Finished", this);

        }
    }
}

ShowConfig.xml:

<event name="publish:end:remote">
  <handler type="Sitecore.Modules.SitemapXML.SitemapHandler, Sitemap.XML" method="RefreshSitemap" patch:source="SitemapXML.config" />
</event>

Log File Error (Possibly Related):

Heartbeat 2017:04:17 17:19:10 ERROR One or more exceptions occurred while processing the subscribers to the 'publish:end:remote' event.
Exception[1]: System.NullReferenceException 
Message[1]: Object reference not set to an instance of an object. 
Source[1]: MyCompany.Framework 
   at MyCompany.Framework.Pipelines.CustomLinkProvider.CustomLinkProvider.GetItemUrl(Item item, UrlOptions options) in E:\Agents\PRG01\_work\5\s\Features\UpgradeToSitecore8.1\Source\MyCompany.Framework\Pipelines\CustomLinkProvider\CustomLinkProvider.cs:line 15
   at Sitecore.Modules.SitemapXML.SitemapManager.GetItemUrl(Item item, Site site, Language language) in E:\Agents\PRG01\_work\5\s\Features\UpgradeToSitecore8.1\Source\SitempXML\SitemapXML\SitemapManager.cs:line 306
   at Sitecore.Modules.SitemapXML.SitemapManager.BuildSitemapItem(XmlDocument doc, Item item, Site site) in E:\Agents\PRG01\_work\5\s\Features\UpgradeToSitecore8.1\Source\SitempXML\SitemapXML\SitemapManager.cs:line 257
   at Sitecore.Modules.SitemapXML.SitemapManager.BuildSitemapXML(List`1 items, Site site) in E:\Agents\PRG01\_work\5\s\Features\UpgradeToSitecore8.1\Source\SitempXML\SitemapXML\SitemapManager.cs:line 230
   at Sitecore.Modules.SitemapXML.SitemapManager.WriteInXml(List`1 items, Site site, Int32 skip, Int32 take, String fullPath) in E:\Agents\PRG01\_work\5\s\Features\UpgradeToSitecore8.1\Source\SitempXML\SitemapXML\SitemapManager.cs:line 74
   at Sitecore.Modules.SitemapXML.SitemapManager.BuildSiteMap(String sitename, String sitemapUrlNew) in E:\Agents\PRG01\_work\5\s\Features\UpgradeToSitecore8.1\Source\SitempXML\SitemapXML\SitemapManager.cs:line 105
   at Sitecore.Modules.SitemapXML.SitemapManager..ctor() in E:\Agents\PRG01\_work\5\s\Features\UpgradeToSitecore8.1\Source\SitempXML\SitemapXML\SitemapManager.cs:line 65
   at Sitecore.Modules.SitemapXML.SitemapHandler.RefreshSitemap(Object sender, EventArgs args) in E:\Agents\PRG01\_work\5\s\Features\UpgradeToSitecore8.1\Source\SitempXML\SitemapXML\SitemapHandler.cs:line 30
   at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result) 

Update: I am now seeing the logging on each CD server. This issue seemed to be that I have to browse at least one page on the each CD server. Maybe the issue is that the application needs to be started.

9
  • Have you checked out the scaling configurations? – Michael West Apr 17 '17 at 20:50
  • They should be fine. What do I need to double check? Each CD server has a unique instance name. – ADH Apr 17 '17 at 20:52
  • Have you reviewed this? ScalabilitySettings.config is often overlooked. doc.sitecore.net/sitecore_experience_platform/… – Michael West Apr 17 '17 at 20:53
  • My settings are correct. The problem is more elusive. – ADH Apr 17 '17 at 20:56
  • Nullref is happening in your custom link provider. You should either debug it or disable – Andrey Bobrov Apr 18 '17 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.