I have recently taken the same approach and I wrote code almost entirely identical to yours. I hadn't considered a threading problem though. I'm not explicitly creating any new threads, so I'm not sure that I do need to worry about it.

One thing I was considering was having the logging to file happening in a different thread. The custom MessageHandler could emit a signal that could be handled by a class in another thread. This might solve your (potential) problem as I believe that the signal/slot mechanism is thread safe, but don't quote me on that.

Oh, wait, do quote me on that...

Qt provides thread support in the form of platform-independent threading classes, a thread-safe way of posting events, and signal-slot connections across threads

This approach also has the advantage of moving expensive file IO into another thread, which might have a positive performance impact.