Only getting log messages from one of my threads at a time early in runtime


I am working on a project based on an AWS Sidewalk example application. I have been adding additional threads to support new features, while maintaining the existing threads used by the Sensor Monitoring example app.

Previously, I have added a new thread to manage an I2C LED driver. This thread has a few LOG_INF messages to indicate when the thread starts, and it will generate LOG_ERR messages if there are errors during initialization. These messages have been working for me as I would expect.

Now, I am adding an additional thread to manage another I2C device (an audio codec). I have followed the same basic thread structure and have added similar LOG_INF and LOG_ERR messages during the setup stages.

In main.c, I am calling the task_start functions at the end of the main function, like so:

    LOG_INF("Sidewalk demo started!");

	sm_task_start();
	flare_led_task_start();
	flare_audio_task_start();
	

	return 0;

I'm finding that with my new thread included, I'm only seeing the LED welcome messages. But, if I change the order, so that the audio thread starts first, then I only see the audio welcome message, and not the LED messages. But I want to see both! This seems like a timing issue of some kind.



Note that the LED thread and the audio thread are both currently set to the same priority level. But, my understanding is that if they are at the same priority, the first one should run until it hits a yield, then the second one should kick in. I know that both threads run eventually, as I can see other log messages from both threads later in runtime. But these init messages are very useful for development and to catch startup issues.

Is it possible that the logging module is unable to keep up with the volume of log messages early in runtime, and is dropping some? If so, why am I not seeing some kind of warning about dropped log messages? Can anyone help me understand why I am not seeing log messages from both threads?

Related