Server.log() messages are received out of order

My doubt is basic enough that I was sure someone must have already pointed it out. But I was not able to find anything on the forum or on the API docs.

Here is the code I have running on the imp:

local num_list = [0xa,0xb,0xc,0xd,0xe,0xf]; local msg = ""; for(local i=0;i<num_list.len();i++) { server.log( format("0x%02X",num_list[i]) ); msg += format("0x%02X ",num_list[i]) } server.log( msg );

And here is the output it produces, which can actually change everytime I run it:

2014-01-31 00:16:10 UTC+8: [Status] Device booting; 1.66% program storage used 2014-01-31 00:16:10 UTC+8: [Device] 0x0E 2014-01-31 00:16:10 UTC+8: [Device] 0x0D 2014-01-31 00:16:10 UTC+8: [Device] 0x0C 2014-01-31 00:16:10 UTC+8: [Device] 0x0B 2014-01-31 00:16:10 UTC+8: [Device] 0x0A 2014-01-31 00:16:10 UTC+8: [Device] 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F 2014-01-31 00:16:10 UTC+8: [Device] 0x0F

Are server.log messages not meant to be received in strict order? If yes, this should at the very least be mentioned on the API docs page.

I did not realize this for the longest time and it was really frustrating me in this other NFC interface program that I was debugging!!

Does anyone have some straightforward way to get them to be sent/printed in strict order? In my example above I resorted to constructing a string and sending that in one call to get the correct order.

Thanks!

A workaround for this might be to insert a short delay after
server.log( format("0x%02X",num_list[i]) );
and maybe before
server.log( msg );

This is a known issue; if you refresh the page they’ll be in the correct order. What browser are you using?

Thanks for the tip about refreshing the browse page!
That really does put all the log messages in the correct order.

I am using Google Chrome on Linux and Windows.