[Development] QLog ( Work on qDebug and friends)

BRM bm_witness at yahoo.com
Thu Feb 2 00:03:57 CET 2012


> From: David Faure <david.faure at kdab.com>

> On Wednesday 01 February 2012 10:02:00 BRM wrote:
>>  I would also suggest that the plugins use a standard public interface class
>>  such as QAbstractLogFacility, like QTcpSocket uses QAbstractSocket - so
>>  that people can add their own custom logging output easily
> 
> This is already available, see qInstallMessageHandler in Qt 5
> (qInstallMsgHandler in earlier versions)

I am very aware of what is in Qt4 right now (http://doc.qt.nokia.com/5.0-snapshot/qtglobal.html#qInstallMsgHandler - and in Qt5 by extension)
This functionality is very primitive when compared to other facilities like syslog or the Windows EventLog.

It does the job for a very basic logging system, but when you need to start categorizing your log messagse it does not do well at all.
I am talking about something that is far more comprehensive, which is also what I believe they were discussion with respect to what I replied to.

Now, I think the existing qDebug() and friends are nice for built-in stuff and for doing some general easy apps; and they should certainly remain the default.
However, we should also offer a more extensive logging system that can be used instead - which registers a message handler and takes over.

Or what about when you want to record to multiple facilities? E.g. sending to syslog and your own file logging.
(This is useful in distributed logging situations so that you can capture a local log and still send out to the distributed log as well.)

I think Qt can offer a basic logging framework that can be optionally used by those that want to use it. It would make a nice Add-on module.
And why force users to rewrite functionality for some of the most common logging systems (e.g. syslog and Windows EventLog)?

Ben




More information about the Development mailing list