Implementing Thread Safe logging in my Qt Application
-
Hi,
What about Qt's Logging Categories ?
You can combine that with qInstallMessageHandler to queue all your messages to your dedicated thread. -
@SGaist Sorry... I forgot to mention; I am using Qt4. The above is only available since Qt5.2.
@Absurd said in Implementing Thread Safe logging in my Qt Application:
Sorry... I forgot to mention; I am using Qt4. The above is only available since Qt5.2.
Any specific reason to use an EOL product version for new development?
-
@Absurd said in Implementing Thread Safe logging in my Qt Application:
Sorry... I forgot to mention; I am using Qt4. The above is only available since Qt5.2.
Any specific reason to use an EOL product version for new development?
@kshegunov Yes; qt4 is installed by default on all of our servers (don't know why, it just how it is), as oppose to qt5 which I'll have to install.
I want my app to run without any additional installations. -
When I would be your server admin I would not allow you to add a new application with a library which last was updated more than 4 years ago... but if you want to develop with such an old library you have to do such work on your own...
Otherwise I would have suggested to use log4qt from here -
@kshegunov Yes; qt4 is installed by default on all of our servers (don't know why, it just how it is), as oppose to qt5 which I'll have to install.
I want my app to run without any additional installations.@Absurd said in Implementing Thread Safe logging in my Qt Application:
I want my app to run without any additional installations.
You should rethink that, as Qt 4.8.7 was released 3 years ago and is the last patch release of the Qt 4.8 minor release, which itself was released over 8 years ago. You should either upgrade your server(s), or build Qt 5 yourself and use it for new development. Otherwise your approach (in the OP) appears sound.
-
When I would be your server admin I would not allow you to add a new application with a library which last was updated more than 4 years ago... but if you want to develop with such an old library you have to do such work on your own...
Otherwise I would have suggested to use log4qt from here@Christian-Ehrlicher
We have few more tools that are implemented with qt4 (for historic reasons, I believe).
What harm could that do? (developing with an old library)Thanks, I'll give logqt4 a try...
-
Security-wise it's a nightmare to use a library which is not up-to-date.
And log4qt only works with Qt5(.9)and above -
Security-wise it's a nightmare to use a library which is not up-to-date.
And log4qt only works with Qt5(.9)and above@Christian-Ehrlicher we use these machines for internal debug only (so are our tools)...
-
@Christian-Ehrlicher we use these machines for internal debug only (so are our tools)...
@Absurd as you have to deploy your app to the server anyway, why not deploy Qt 5 together with them?
All existing apps stay unchanged, but the new ones start using their own libraries.
Qt Creator does it like this, for example.
-
@Absurd as you have to deploy your app to the server anyway, why not deploy Qt 5 together with them?
All existing apps stay unchanged, but the new ones start using their own libraries.
Qt Creator does it like this, for example.
@aha_1980 to be honest, I'd prefer working with qt5, and I also tried to install it on one of our machines before starting the project, but I ran into so many problems and it was so complicated so I gave up.
Now it's too late anyway, because I wrote so much code in qt4... (unless qt5 is completely backward compatible with qt4)
-
@aha_1980 to be honest, I'd prefer working with qt5, and I also tried to install it on one of our machines before starting the project, but I ran into so many problems and it was so complicated so I gave up.
Now it's too late anyway, because I wrote so much code in qt4... (unless qt5 is completely backward compatible with qt4)
Now it's too late anyway, because I wrote so much code in qt4...
For sure not ;)
(unless qt5 is completely backward compatible with qt4)
Not completely, but in many ways. I've a lot of tools compatible with both versions. That needs a few
#ifdef
, but that's it.I'd recommend doing the upgrade incrementally, because Qt 6 will appear in 2..3 years and Qt 5 will be similar to what Qt 4 is now.