how to introduce new line into message-log policy

Not applicable

Hi - does anyone know how to force the message-logging policy to line feed at the end of a line?

I have a way to do it but it introduces some extra spaces into the mess (or forces me to have a really messy XML doc in the UI which I dont like.)

Thanks.

0 11 2,059
11 REPLIES 11

Not applicable
This works:
....
<MessageLogging async="true" continueOnError="false" enabled="true" name="Request-Log"><DisplayName>Request-Log</DisplayName>
	<File>
	<Message>mesage here
</Message>
    	<FileName>request.log</FileName>
    	<FileRotationOptions rotateFileOnStartup="true">
....

but it rubs me the wrong way to have to do things this way.

i have not tried it - but have you tried XML encode the crlf? Maybe just try

'ampersand#10;'
'
'

I could find a way to encode it in the answer 🙂 -- [ampersand == &, replace it]

Thanks,

Do we have a solution here? @Mukundha Madhavan @Prithpal Bhogill

Not applicable

You may want to try this <FlushAfterEachWrite>true</FlushAfterEachWrite> which is false by default ? I think that will log the message in a new line .

Tried below but still don't see a change.

<FlushAfterEachWrite>true</FlushAfterEachWrite>

Any better way to have a good format into logs using messagelogging policy?

If it is an Apigee custom variable string, you could try adding a '\n' (Unix) or '\r\n' (Windows). This worked for me when I was logging into a Syslog instance.

I tried and its worked for me .Here is the sample,

<Message>{"requestVerb":"{request.verb}","messageStatusCode":"{message.status.code}","timeStamp":"{system.time}"}

"& # x D ; "</Message>

please remove the space and double quote "& # x D ; "

Yes you can add nextLine in your message defined in this policy by simply adding character " & # x D ;"


like:
<message> Here is your message "& # x D ; "</message>

Note: Remove space between characters. Apigee community site didn't allowed me to answer this without space.

I have also tried this, this works perfectly.

Hello.
I had to use 

"& # x D ; & # x A ;"

(without the spaces)

pinedajam
Participant I

Hi, Is there a way to remove the white spaces in front of the message inside the logs?

7875-capture.jpg