cancel
Showing results for 
Search instead for 
Did you mean: 

Java mapping abstract trace logs in single Java stack

0 Kudos

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!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Alberto & all,

Just published this blog. Hopefully this will help you.

Kind regards,

Kapila

Answers (1)

Answers (1)

allamudi_loordh
Active Participant
0 Kudos

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?frame...

Regards,

Loordh

0 Kudos

Hi,

I have already checked those properties of the iflow, as you can see in the fourth screenshot.

There you can see that logging and staging is enabled for all the steps and still I can not see the traces of the Java mapping.

Thaks and Regards.

0 Kudos

Hello,

Has anyone face the same problem. I still have no clue about how to solve it.

Thanks & Regards!!!

allamudi_loordh
Active Participant
0 Kudos

Hi Alberto,

can you please try the below options suggested in blog.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/11/06/message-staging-and-logging-optio...

Regards,

Loordh

0 Kudos

Hi,

thanks for your reply, but I have already seen that blog. It refers to looging and stagging:

"Purpose of message staging is persistence of an asynchronous message at a particular runtime processing step (stage) for later editing/restart of the message from the persisted version as well as for displaying persisted (staged) message.

Purpose of message logging is persistence of any kind of an asynchronous/synchronous message at a particular runtime processing step for later displaying of the persisted (logged) message. Please note that editing or restart of the logged message is not possible."

But it does not mention anything about the Java mapping traces, and as I said before, regardless of the logging and staging configurations, the java mappings traces are not shown.

Does anyone has a solution or is facing the same problem?

Regards.

vadimklimov
Active Contributor
0 Kudos

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 ID

String 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 it

MessageKey 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