Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

Logger: simple, convinient and thread safe logger for Qt applications

  • How about logging size ? I searched in several Qt based logging libs ( QxtLogger, log4qt ..... ) didn't find any functions in it, related to the size of log functionality. So it will be very usefull to see this functionality !

  • I don't understand the question. What do you mean with 'logging size'? Do you want to set some kind of maximum size for the log file output or something like that?

  • Yes, for example : maximum log messages ( last 100 messages ) , or maximum log file size.

  • I search frew several projects, and no one provide such functionality. Only log4qt, but it hard to understand, and implement.

  • Personally, I think log rotation is a separate task. It seems quite expensive to do something like limiting to the last 100 messages. It means re-writing the entire logfile for each message, as you cannot remove from the start of a file. Adding is trivial though.

  • i already tried my self re-writing file and this real complex task, and heavy in time execution... but log can be very fast happend... but what, if i don't need handle a lot of messages ....

  • I have no idea what you just asked. Sorry.

  • IMO the most correct way to implement a log rotation is to create separate log files for every week/day/hour (choose yours interval) and to automatically remove older logs becoming obsolete. For example, Apache web server logging is organized in such a way. We've implemented that kind of log rotation for one of our projects using Logger some time ago, but I've never published those classes. The problem is I can't share the source because of some licensing restrictions (it was created by another developer working on a commercial project).

    Anyone interested in implementing that kind of functionality (and adding it to logger mainstream code) could easily contact me via email or simply post a merge request on gitorious.

  • Just merged "one important change": (thanks goes to Pritam Ghanghas). Now LOG_DEBUG() and other similiar macros supports all the features of qDebug() and could also support the printf-like syntax so we can simply search-and-replace qDebug() with LOG_DEBUG() and QDebug or QtDebug header with Logger.h

    Still waiting for your contributions to make Logger more useful :)

  • Just wanted to notify the project's maintainers that cutelogger doesn't compile using Qt 5 Beta2 with deprecated API turned off by default: qInstallMsgHandler() has become deprecated.

  • Ok, thank you for notification. Currently there is only one project maintainer and I don't have much time for now to implement and support the Qt 5.0.0 compatibility of the project.

    Taking a quick look through the Qt 5 beta2 headers I've noticed there is a lot of work to be done refactoring the Logger to take advantage of the extended Qt 5 logging abilities. If anyone is willing to implement Qt 5 compatibility and post it as a merge request on Gitorious the contribution will be kindly accepted :)

  • Pushed "e3c2745": Now Logger successfully builds with Qt 5 and uses some of its advanced logging feature (e.g. file/line/function name gathered in renewed qDebug and the same macros).

    Still some work to be done to support "log categories":,13226 and new Qt log formatting feature in a ConsoleAppender.

  • How do I enable/disable the CuteLogger?

  • @cyberbobs said:


    Hello! How do I connect this component to my program, it is necessary to compile? I can not find a solution.
    I copied files but there were errors.
    android/log.h: No such file or directory
    #include <android/log.h>

    windows.h: No such file or directory
    #include <windows.h>

    My system Ubuntu 14.04

  • @Alexorleon Replied to your question on Github. Basically, you don't need to include windows-specific or console appenders to Android project, it is already handled in pro file included in the library sources. Also, it is suggested that you will include CuteLogger sources to your project (if you store project in git repository, you can add it as submodule) and build it alongside your project instead of building it separately and adding the prebuild libraries.

  • Hey, thanks for this library, it's really cool.

    I'd like to know if it was possible and safe to write in several files? I'd like to create several FileAppender's and decide in which of these files I should write.

    Is there any way to indicate to LOG_INFO() the FileAppender I want to write in?

  • Use syslog, it's simple, convenient and thread safe, and has powerful tools to work with (e.g., syslog-ng server). Don't reinvent the wheel!

  • @Gregoire-Borel Actually, the categorized logging feature is made just for that case. Please, take a look at Logger::registerCategoryAppender(). After adding the appender for the category (which is basically just a string identifier) you may use LOG_C* macros to write records to the specific categories or make use of LOG_CATEGORY macro (I'm pretty fond of it myself :), allowing you to automatically redirect every log record made from inside some class to the category you picked.

  • Hey, thanks for this library, very usefull and easy to use

    I'd like to know if someone used it on IOS and if there is any potential known issues on this platform ?

  • @_JR_ You're welcome :) Personally I neither had any experience in writing iOS apps nor have the necessary hardware/keys/certificates for that. So any input on the subject will be useful (but I doubt that it will be possible to make any enhancements based on that).

Log in to reply