2

I am trying to debug a publishing problem with the Sitemap XML module.

Publishing XML Sitemaps to Two Content Delivery Servers

Someone suggested creating a simple event handler that does a Log.Info("***** Custom Event Fired *****") and add it to publish:end:remote then check the logs on each server. To rule out a bug with the module and/or identify issues with remote events.

But, I'm not sure how to do that. Any help will be appreciated.

1 Answer 1

1

The Sitecore XML module appears to trigger rebuild based on when certain Sitecore events are fired off (publish:end and publish:end:remote). In order to ensure that those events are being correctly fired on CD instances, you can also create a similar handler:

using System;
using Sitecore.Diagnostics;

namespace MyProject.CMS.Custom.Events
{
    public class EventHandler
    {
        public void LogEvent(object sender, EventArgs args)
        {
            Log.Info("***** Custom Event Fired *****", this);
        }
    }
}

And patch this into the events using a config patch file:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <events>
      <event name="publish:end">
        <handler patch:before="*[1]" type="MyProject.CMS.Custom.Events.EventHandler, MyProject.CMS.Custom" method="LogEvent"/>
      </event>
      <event name="publish:end:remote">
        <handler patch:before="*[1]" type="MyProject.CMS.Custom.Events.EventHandler, MyProject.CMS.Custom" method="LogEvent"/>
      </event>
    </events>
  </sitecore>
</configuration>

After deploying the code, check your logs on both the CM and the CD servers for the presence of the message. If the events are fired off correctly then the messages should be present.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.