Log printing right before reset causes broken text over RTT

Used SDK: 15.2.0

Hello,

I want to print some debug messages over RTT after an error occured. After that I want to reset the system.

If I put the string into the que with NRF_LOG_INFO("Debug Text"), then forcing the log module to print out all the strings in buffer with NRF_LOG_FINAL_FLUSH(), then calling NVIC_SystemReset() to reboot the system will cause broken text output in J-Link RTT viewer. It seems that the NRF_LOG_FINAL_FLUSH() function does not block the code until all the text was sended out.

Including a delay before triggering the reset will solve the problem. But with various length of the debug messages, calling a fixed delay is not a well made solution. Also the documentation sais, that calling NRF_LOG_FINAL_FLUSH() is made for exactly this problem.

Do you know whats going wrong?

Thank you, Regards

Mr_BLE