Issue in using Single Message Logging Policy to log the data of multiple points

Hi All,

I need to do logging at 4 points.

1. Request -in : As soon as I receive the request.

2. Request-Out: Before sending the request to Backend.

3. Response-In: After the getting response from backend

4. Response-Out: Before sending the final response to client.

I am using javascript to store data in flow variables for every log point let's say (logRequestIn, logRequestOut, logResponseIn, logResponseOut). I have stringified JSON data in these variables.

In PostClientFlow I am using a Message Logging Policy to log this entire data.

<MessageLogging name="Log-Logging">

<Syslog>

<Message>{logRequestIn}{logRequestOut}{logResponseIn}{logResponseOut}</Message> <Host>localhost</Host>

<Port>6514</Port>

<Protocol>TCP</Protocol>

</Syslog>

</MessageLogging>

With above approach only last entry is getting logged in the third party server.

Is this a correct approach to log the entire data at once?

When I am trying it with 4 Message Logging policies and each logging policy having only one flow variable, I am getting entire data in the log server.

Could you please suggest how to proceed on this.

Thanks,

Vinita

0 3 203
3 REPLIES 3

@Anil Sagar @ Google, @Dino-at-Google :
Could you please help with the above query.


With above approach only last entry is getting logged

What is the last entry? What do you mean by "last entry" ?

Do you mean that the content of logResponseOut is the only thing that gets logged? If so, Are you certain that those other variables hold valid values? Are you certain the spelling is correct?

Not sure if this helps, but you can capture the message.content at various points in your flow, like below (in AssignMessage policy):

(proxy preflow request) ---- A ------ B --- (target preflow request)

(proxy preflow response)---- D ------ C ---- (target preflow response)

where A, B, C and D are AssignMessage policies.

A -> logRequestIn = {message.content}

B -> logRequestOut = {message.content}

C -> logResponseIn = {message.content}

D -> logResponseOut = {message.content}

Note: (Still need to factor is FaultRules as well)

Then, as indicated in your MessageLogging policy, just log them. If you are only getting the last entry, you might be overriding the content.

Thanks,

Girish