I am trying to implement a very basic event system example in tridion 2011 sp1. I have followed below steps.
Created a class library project. Here is my code
[TcmExtension("TridionEventSystemTest")] public class TestEvent : TcmExtension { public TestEvent() { Subscribe(); } public void Subscribe() { EventSystem.Subscribe<Component, DeleteEventArgs> (OnComponentDeletePre,EventPhases.TransactionCommitted); } private static void OnComponentDeletePre(Component com, DeleteEventArgs args, EventPhases phases) { string source = "custom event system"; string message = "custom event handler has been executed successfully"; if (!EventLog.SourceExists(source)) EventLog.CreateEventSource(source, "Application"); EventLog.WriteEntry(source, message); EventLog.WriteEntry(source, message, EventLogEntryType.Warning, 234); } }
I did shut down iis, com+ services, tridion content manager service host
- Copied the class library project dll
- Added extension in tridion content manager config
- Restarted all the above services
When I delete a component in CMS I can see the below message in event viewer
TCM Extension initialized: TridionEventSystemTest (TridionEventSystem.TestEvent)
Component: Tridion.ContentManager Errorcode: 0 User: NT AUTHORITY\NETWORK SERVICE
I can not see any other message related to event system in event viewer. So I think my event handler is not getting called even when TCM Extension is initialized.
Please help,
EventLog
?