[Development] QLog ( Work on qDebug and friends)

kai.koehne at nokia.com kai.koehne at nokia.com
Wed Feb 22 09:19:12 CET 2012


> -----Original Message-----
> From: Beck Wolfgang (Nokia-MP/Brisbane)
> Sent: Wednesday, February 22, 2012 1:38 AM
> To: Koehne Kai (Nokia-MP/Berlin); ext David Faure
> Cc: development at qt-project.org
> Subject: RE: [Development] QLog ( Work on qDebug and friends)
> 
> Why you want to use the categories somewhere else then QLog?

As I said, there are two possible reasons to have categories
 * filtering. This is what apparently QLog is about 
 * As an additional information to quickly see where messages 'belong to'. E.g. a hypothetical log file might read

...
[warning] MyApp QtCore: QBuffer::setBuffer: Buffer is open
[warning] MyApp QtCreator.HelpManager: Error registering namespace 'Qt'
...

'QtCore', 'QtCreator.HelpManager' would quickly tell me where the messages belong to.  (We're of course somewhat providing this info for the Qt Libraries already by encoding some context in the message itself ('QBuffer::setBuffer'). But other applications don't necessarily do this).

In understand that this is exactly what the 'area' in KDE/kdebug is about.

(Honestly speaking, we can of course live without this feature. But if we do it like in KDE, you'd provide a 'default' context by a compiler define, so the source code itself wouldn't get any uglier + the overhead wouldn't be that big. And since we already have a free-text 'category' field for qLog, why not allow it to be also put into the log file?).

> You want to reinvent a mechanism to filter the categories then?

I wouldn't provide one in Qt. But adding the category to the log message itself would allow to do filtering by system tools like grep, or rsyslog. That is, _after_ running the application.

> If you don't filter what sense makes having the categories?
> I mean you still have qDebug and you can write whatever you like.
>
> Cheers,
>  WB
> 
> 
> 
> -----Original Message-----
> From: Koehne Kai (Nokia-MP/Berlin)
> Sent: Tuesday, February 21, 2012 8:20 PM
> To: ext David Faure
> Cc: Beck Wolfgang (Nokia-MP/Brisbane); development at qt-project.org
> Subject: RE: [Development] QLog ( Work on qDebug and friends)
> 
> > -----Original Message-----
> > From: ext David Faure [mailto:david.faure at kdab.com]
> > Sent: Tuesday, February 21, 2012 11:08 AM
> > To: Koehne Kai (Nokia-MP/Berlin)
> > Cc: Beck Wolfgang (Nokia-MP/Brisbane); development at qt-project.org
> > Subject: Re: [Development] QLog ( Work on qDebug and friends)
> >
> > On Tuesday 21 February 2012 10:02:23 kai.koehne at nokia.com wrote:
> > > I agree with that: On the desktop it's quite handy to see also
> > > detailed output on stderr/the shell (which one can redirect to a
> > > file if
> > needed).
> > > But I also think that qLog() messages shouldn't show up by default
> > > for normal users, that is, unless the category has been explicitly enabled.
> >
> > True.
> >
> > > So how about adding another QtMsgType called QLogMsg, that qLog()
> > > uses? In contrast to qDebug/QtDebugMsg, qLog/QtLogMsg messages
> > would
> > > not be processed by default, unless the configuration file (or an
> > > environment
> > > variable) says so ...
> >
> > Isn't the same information given by "a category is present in the
> > QMessageLogContext"? All qLog calls are forced to get a category, right?
> 
> Right, but that would mean we can't use categories for anything except qLog.
> If we use categories solely for the purpose of filtering that's probably fine,
> but I personally also see some value in having them available as free text in
> the log, for all log QtMsgType's ...
> 
> Regards
> 
> Kai
> 
> 
> > --
> > David Faure | david.faure at kdab.com | KDE/Qt Senior Software Engineer
> > KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84
> > 08 53, Sweden (HQ) +46-563-540090 KDAB - Qt Experts -
> > Platform-independent software solutions




More information about the Development mailing list