Creating Audit Log Entries
You can write entries to the audit log database.

uml_auditlog.wmfcontains the class diagram in UML format. Open Word and import uml_auditlog.wmf as a graphic.
Before audit log entries can be written, you must first create the AuditMessageKey. This key comprises the messageID of the XI message object and the direction.
· Use AuditDirection.Inbound for messages that are forwarded to the adapter from the Adapter Framework.
· Use AuditDirection.Outbound for messages that are forwarded to the Adapter Framework from the adapter.

The use of the terms inbound and outbound here is not consistent with the usual use in Process Integration.
The messageID and direction represent the key in the database table of the audit log.
The log entry can be written as is shown in the following example.

Open SPIManagedConnectionFactory.java and search for the character string CS_TRAUD.
If one of the methods is called without the input parameter AuditMessageKey, the following steps are performed:
· Exactly one audit log record (perThread) without the AuditMessageKey object is written internally to the cache.
· When addAuditLog() is called with an AuditMessageKey object in the same thread for the first time, the information about the messageID and the direction is added to the audit log entry that is stored in the cache.
· When flushAuditLogEntries() is next called, all entries in the cache are written to the audit log database.

To avoid unnecessary audit log entries, adapters must not use flushAuditLogEntries() for synchronous messages.
When testing your adapter, you can convert a property in the Visual Administrator to be able to display the payload of a synchronous message in the message monitor.
In the Visual Administrator, set the following property in the Service SAP XI AF Messaging.
Messaging.syncMessageRemover.removeBody = false

Only change this parameter in a test system. Changing this setting in a productive system can lead to OutOfMemory exceptions on the J2EE server if numerous large, synchronous messages use up the main memory.