DetailPage-MSS-KB

Knowledge Base

Article ID: 952735 - Last Review: August 2, 2011 - Revision: 2.0

INTRODUCTION

This article describes how to add your own exception handling to the Application Integration Framework (AIF) and how to create your own logs in Microsoft Dynamics AX.

MORE INFORMATION

Usually, the AIF error log does not provide all the information that you must have to troubleshoot a problem. Therefore, you may want to add information to the error log. You can do this by creating additional exception handling in the Microsoft Dynamics AX project.

Additionally, you may want to create your own Windows event log for a specific situation. For example, you may want to send your information to Microsoft Customer Support Services. Or, you may want to have a better understanding of a specific process.

Tips about how to create your own exceptions and logs
  • It can be useful to create your own exception-handling functions in the Axd class, in the AifInboundProcessingService class, and in the AifOutboundProcessingService class.
  • You can use the xppCallStack method of the xSession class to understand how Microsoft Dynamics AX propagates an exception message through an application.
  • You can successfully debug the AifGatewayReceiveService class. However, debugging is limited in the AifInboundProcessingService class and in the AifOutboundProcessingService class.
For more information, download a private project for AIF exception handling improvement.

The following file is available for download from the Microsoft Dynamics File Exchange Server:

952735 (https://mbs.microsoft.com/fileexchange/?fileID=1a697484-dfc4-40ac-be96-ab5c974dfaec)
Release Date: 5/6/2008

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.

By using this sample project, you can log exceptions to the SysExceptionLog table. The AIF uses this table for error logging. You can also send an send an infolog message to the event log. This infolog message may be your own custom message.

To create your own AIF exception handling process, follow these steps:
  1. Import the 952375 AIF exception handling improvement project.
  2. Locate the prepareForSave() method in the AxdSalesOrder class.
  3. Add the following code:
    OwnAifExceptionHandling::createException("AifException",NoYes::No,Exception::Error);
When you follow these steps, a log for the SysExceptionTable table is created. The log contains your message and a call stack.

Notes

The following items are important if you use the downloaded project:
  • You must put the call to the OwnAifExceptionHandling::createException(...) static method as close as possible to the point at which you communicate with the database. For example, you can put the call to the OwnAifExceptionHandling::createException(...) static method in the prepareForSave() method. Or, you can put the call just before you call the methods of the AifQueryCriteria class. By studying the included call stack, you can find more locations to insert an exception.
  • You must run the Microsoft Dynamics AX client as an administrator. If you do not, a new log file is not created on the system.
  • To view results in the event viewer, you must run the project first, and then open the event viewer. After you open the event viewer, you can run additional projects and then click Refresh in the event viewer to see a new result.
  • If you want to write to the event log, you must set the _useEventLog parameter to Yes when you call the script.

    Note You can only hand over a specific exception type if you use the internal SysExceptionTable table.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide extra functionality or construct procedures to meet your specific requirements.

APPLIES TO
  • Application Integration Framework (AIF), when used with:
    • Microsoft Dynamics AX 4.0
Keywords: 
kbexpertiseadvanced kbmbsmigrate kbhowto KB952735
Freigeben
Weitere Supportoptionen
Microsoft Community-Supportforen
Kontaktieren Sie uns direkt
Zertifizierten Partner finden
Microsoft Store