Posts

Showing posts from June, 2012

Enable Windows event Log In Axapta

I have implemented Dynamics AX Event Logs in Test environment, This can be particularly useful when you would like to use the Windows Event Log to monitor AX batch Jobs. For getting this feature enabled,I have added a new static method called writeLogEntry to the Global class: static void writeLogEntry(Exception e, str caller, int line, str text) { // Use the standard .NET class EventLog from // the System.Diagnostics assembly System.Diagnostics.EventLog eventLog; // Also use a .NET enumeration from the // System.Diagnostics assembly System.Diagnostics.EventLogEntryType entryType; System.Exception clrException; str stack; Batch batch; str batchInfo; ; try { // Create a new object of the EventLog class eventLog = new System.Diagnostics.EventLog(); eventLog.set_Source("Dynamics AX"); // Set the enumeration value based on the Exception // type in AX switch (e) { case Exception::Info : entryType = System.Diagnostics.Even