I have an application where I want to log messages to a common logger from two different threads.
In the example below, I am expecting that the the messages from both threads will be printed to System Out, but if I run the code as-is, I only seethe message from the second thread, and if a add a sleep/yield between the two threads, I only see the message from the first thread.
I can work-around the issue by place a queue between the threads and the logger, so that only a single thread to logging, but I would prefer not to have to do this.
Any suggestions on how I can over-come this problem?
OS: Windows 10 64 bit version 1709