Setting SCHED_FIFO or SCHED_RR policies is only appropriate if you were setting high scheduling priority levels (unusual in a user application). The default policy is SCHED_OTHER.
There is sometimes confusion between scheduling
priority and the
nice level. Although SCHED_OTHER threads are all run at scheduling priority 0, the scheduling algorithm takes into account the nice level of the thread in determining the allocation of cpu resources. Unlike the scheduling priority, the nice level is merely a guide to how aggressively the thread is prioritized.
What this means is that you don't use the
attr to change the scheduling policy or priority, but instead use
setpriority to change the nice level of the thread.
However, I would note that if your logging thread is actually causing the application to fail, then you have an problem in your thread logic. Even if you could force prioritization (and you can't for SCHED_OTHER threads), priorities are an error prone way to solve thread communication issues. The nice level is there purely to improve the performance or responsiveness of a thread.