Skip to Content

Java mapping abstract trace logs in single Java stack

Hello,

We are migrating some PI scenarios from SAP PI 7.11 to a single Java stack PI 7.3.1.

One of those scenarios has a java mapping that uses the class com.sap.aii.mapping.api.AbstractTrace for logging purposes:

AbstractTrace trace = null;

trace = getTrace();

….

trace.addWarning(message, e);

This logging utility generates entries in the trace of the request messaging phase in PI 7.11. You can see this in the sxi_monitor transaction:

You can also see this logs in the test utility of the Message Mapping or Operation Mapping that uses this Java Mapping:

In these tests utilities the logs can be seen in the PI 7.3.1 installation too.

However, in PI 7.3.1, you cannot see these logs in the message monitor. The only log you can see is the following:

As you can see, you can only see a log that says that the OM is being executed:

Executing Request Mapping
"urn:XXXXXX/OM_FLAG_TO_SFTP_TO_LOG" (SWCV b40ee780331d11e2bcf0e8acac1a54e5)

This behavior is the same, regardless of the logging and staging level of the iflow scenario:

I have been searching the scn and I have found the following links about the staging and the logging:

All of these and much more refer to whether you want to log or stage the payload of the message in the different stages of the process. But I haven’t seen anything that indicates you how to show the mapping logs in the message monitor:

¿Does anyone know how this can be achieved?

Thanks!

Captura1.JPG (112.2 kB)
Captura2.JPG (158.7 kB)
Captura3.JPG (80.5 kB)
Captura4.JPG (78.7 kB)
Captura5.JPG (88.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 18, 2013 at 05:46 AM

    Hi Alberto & all,

    Just published this blog. Hopefully this will help you.

    Mapping Trace in SAP PI 7.31 Single Stack

    Kind regards,

    Kapila

    Add comment
    10|10000 characters needed characters exceeded

  • May 09, 2013 at 03:53 PM

    Hi

    Can you please check the Advance settings tab in ICO, enable staging and logging.

    http://help.sap.com/saphelp_nw73ehp1/helpdata/en/7a/c83c3c90b74c1f9a00d761496e28ea/content.htm?frameset=/en/48/b2e0036b156ff4e10000000a42189b/frameset.htm

    Regards,

    Loordh

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Alberto,

      Logging and staging functionalities described in that blog are not of use here since their goal is to persist the message, but not to manage specific audit log entries individually.

      AbstractTrace is used in the custom mapping / UDF to create trace entriesand not audit log entries - this actually explains why, even when utilizing AbstractTrace, you don't see those entries in the audit log of the message and observe them in collected traces.

      It should be noted that trace entries and PI message audit log entries are two different techniques for logging runtime data - and underlying realization is different for them. Thus, insertion of trace entries has no effect on audit log entries of the processed message and vice versa.

      If the intention is to add custom audit log entries from the custom mapping program, you should utilize Audit object (com.sap.aii.af.service.auditlog.Audit) for this. Here is a sample code:

      final String DASH = "-";// Retrieve message IDString msgID = arg0.getInputHeader().getMessageId();// Convert message ID to UUID format (according to RFC 4122)String uuidTimeLow = msgID.substring(0, 8);String uuidTimeMid = msgID.substring(8, 12);String uuidTimeHighAndVersion = msgID.substring(12, 16);String uuidClockSeqAndReserved = msgID.substring(16, 18);String uuidClockSeqLow = msgID.substring(18, 20);String uuidNode = msgID.substring(20, 32);String msgUUID = uuidTimeLow + DASH + uuidTimeMid + DASH + uuidTimeHighAndVersion + DASH + uuidClockSeqAndReserved + uuidClockSeqLow + DASH + uuidNode;// Construct message key and add new audit log entry for itMessageKey msgKey = new MessageKey(msgUUID, MessageDirection.OUTBOUND);Audit.addAuditLogEntry(msgKey, AuditLogStatus.SUCCESS, "Custom audit log entry generated by custom mapping program");

      Using underlying functionality of AuditLogManager - and precisely Audit object, you will be able to persist audit log entries that you can further observe in Message Monitor, in message audit (processing) log.

      Regards,

      Vadim