Wondering how to write something to the event logs in version 9.0
Wondering how to write something to the event logs in version 9.0
In C# code you can get the IEventLog API and then call Write, for example:
var log = Apis.Get<IEventLog>(); var options = new EventLogEntryWriteOptions { Category = "Your Category Name", EventId = 1, // Your Event Id EventType = "Information"; // Or "Warning" or "Error" }; log.Write("Your Message", options);
In Velocity code:
#set($category = "Your Category") #set($eventId = 1) ## Your Event Id #set($eventType = "Information") ## Or "Warning" or "Error" $core_v2_eventLog.Write("Your Message", "%{Category = $category, EventId = $eventId, EventType = $eventType}")
Hope this helps!
Rhys