Subscribing To Notifications
Subscribing to notifications allows you to listen to specific events and run custom code in response.
Create a Notification Handler
using Umbraco.Cms.Core.Events; using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;
namespace MyProject;
public class LogWhenPublishedHandler : INotificationHandler<ContentPublishedNotification>
{
// Here we will handle a notification.
}Implement the Handle Method
Inject a Logger for Logging
Log the Content Publication
Register the Notification Handler
Publishing Content and Verifying Custom Log Messages

Log Viewer

Additional Notes
More Information
Last updated
Was this helpful?