[Development] QLog ( Work on qDebug and friends)

wolfgang.beck at nokia.com wolfgang.beck at nokia.com
Wed Feb 22 01:21:41 CET 2012


I guess you misunderstood me.
QLog is enabled ONLY if a config file was found.
We have 3 ways to define the config file:
1. Default using application name configuration default path and organization name for the path
2. Application developer can call the QLog function "setDefaultConfigFile
3. Config file is defined in the environmane variable "QLOG_CONFIG_FILE".
This logic was discussed in the mailing list.
Please have a look at http://codereview.qt-project.org/#change,13226
QLogPrivate constructor in qlog.cpp.

To be crystal clear:

QLog       |   QLog           
Enabeld |  Config File
NO          | no file defined
NO          | no file found
YES          | file found


If you don't specify "OutputFile" in the QLog config file or the environment variable "QLOG_CONFIG_FILE" the output will be stderr (default).
ONLY if you specify the "OutputFile" key file or the environment variable "QLOG_CONFIG_FILE" QLog will write into that file.
We assume for the next table that QLog is enabled.

QLog                                     |  QLog                            | QLog Config               | 
Writes Into output file  |   Writes into stderr  | OutputFile defined | 
No                                        |  Yes                               | No                                   |
Yes                                       |  No                                | Yes                                  |

Hope that makes it clear now.
Seems that QLog code is a little hard to read so I will add a lots of commends in there :).


-----Original Message-----
From: ext David Faure [mailto:david.faure at kdab.com] 
Sent: Tuesday, February 21, 2012 7:36 PM
To: Beck Wolfgang (Nokia-MP/Brisbane)
Cc: development at qt-project.org
Subject: Re: [Development] QLog ( Work on qDebug and friends)

On Tuesday 21 February 2012 06:28:38 wolfgang.beck at nokia.com wrote:
> I'm preferring having QLog active only if a config file is there.
> It doesn't make sense to me at all having an environment variable that 
> can activate QLog but not config file to activate the categories. As 
> long there is no config file QLog is disable and uses less performance 
> as possible but still having the feature that you can activate it 
> without recompiling the code.

Why? IMHO things should go to stderr by default. So it makes perfect sense to see the output, even if one didn't configure output files in a config file.

I guess this is a mobile platform vs desktop platform discussion. On a mobile platform the logs are only useful if they go to a file, while on the desktop the logs are useful also if they go to stderr, to get them in a terminal or in the session log file.

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