However debug point is not hitting the publish event. I checked log files and logs were also not captured. Could anyone please try and let me know how to handle content service publish events.
I tried the following ways, but still no luck.
1. Visual studio IDE debugging.
2. Hosted site in IIS.
Code :-
using Umbraco.Core.Composing;
using Umbraco.Core.Services.Implement;
using Umbraco.Core.Logging;
namespace Azure_Deployment_Production.Events
{
public class LogWhenContentPublished : IComponent
{
private readonly ILogger _logger;
public LogWhenContentPublished(ILogger logger)
{
_logger = logger;
}
public void Initialize()
{
ContentService.Published += ContentService_Published;
}
private void ContentService_Published(Umbraco.Core.Services.IContentService sender, Umbraco.Core.Events.ContentPublishedEventArgs e)
{
_logger.Info<LogWhenContentPublished>("Something has been published...");
foreach (var publishedItem in e.PublishedEntities)
{
_logger.Info<LogWhenContentPublished>(publishedItem.Name + " was published");
}
}
public void Terminate()
{
// unsubscribe on shutdown
ContentService.Published -= ContentService_Published;
}
}
Umbraco 8.6.4 Content Service publish event not working for me. Any suggestions please.
Hi,
I followed the inline url and tried capturing published event.
https://our.umbraco.com/documentation/getting-started/Code/Subscribing-To-Events/
However debug point is not hitting the publish event. I checked log files and logs were also not captured. Could anyone please try and let me know how to handle content service publish events.
I tried the following ways, but still no luck. 1. Visual studio IDE debugging. 2. Hosted site in IIS.
Code :-
You need to register/compose your component:
is working on a reply...