tags:

views:

1766

answers:

3

What logging facilities do you use whit Qt ?

Do you choose qDebug(), qWarning(), qCritical(), qFatal() methods, or maybe something like Log4cpp (Log4cplus etc.), or maybe some custom-maked code ?

+2  A: 

I'm not using Qt, but for logging I'm using a modified version of Dr'Dobb's Logging in C++. The original code can be found here.

My modifications are specific to the Microsoft Windows platform (fopen doesn't allow file read sharing) and can be found here.

Cristian Adam
+5  A: 

Existing C++ logging libraries are too heavy for my tastes, so I have created a custom front-end based on ideas from Logging in C++ for the Qt qInstallMsgHandlerq back-end. It's cross-platform and thread-safe. Someday I'll clean up the code and release it to the world :)

An interesting alternative for Qt is QxtLogger.

rpg
Maybe QxtLogger is best solution for Qt based projects. Only drawback (at my opinion), that this logger is part of pretty big library. Anyway, thanks for your advise.
vnm
@vnm: I have published my logging library at http://bitbucket.org/razvanpetru/qt-components/downloads/
rpg
@rpg: Ok. I'll take a look. Thanks
vnm
+1  A: 

Depends on how you want to use that log data.

If it is used for debugging at runtime, qWarning() would do just fine.

If you need to debug retrospective (usually server side code), plain old text files are the best. It is best to organize these log files by day log is written.

Pavels