logging to different files via qInstallMessageHandler
-
Then filter by a keyword in the text. I don't see that your usecase could be handled easier with other logging systems...
-
Hi!
I need to store logs in a different files in one app.
Is it possible to add some tag to 'log' method?I see qInstallMessageHandler has a fixed input parameters.
@sitesv
typedef QtMessageHandlervoid myMessageHandler(QtMsgType, const QMessageLogContext &, const QString &);You cannot change/add to those parameters. The message type & context are set for
qDebug()and other inbuilt callers, you cannot use those to pass extra information.If you are you using your own logging messages see QLoggingCategory Class for creating your own categories and what you can do with them.
-
@sitesv
typedef QtMessageHandlervoid myMessageHandler(QtMsgType, const QMessageLogContext &, const QString &);You cannot change/add to those parameters. The message type & context are set for
qDebug()and other inbuilt callers, you cannot use those to pass extra information.If you are you using your own logging messages see QLoggingCategory Class for creating your own categories and what you can do with them.
@JonB said in logging to different files via qInstallMessageHandler:
If you are you using your own logging messages see QLoggingCategory Class for creating your own categories and what you can do with them.
The problem is a storing in the various files, not a creation my own category.
The target QFile is used in messageHandler only.
-
Hi!
I need to store logs in a different files in one app.
Is it possible to add some tag to 'log' method?I see qInstallMessageHandler has a fixed input parameters.
@sitesv said in logging to different files via qInstallMessageHandler:
Is it possible to add some tag to 'log' method?
As @JonB already told you - the category is the tag where you can filter on.
-
@sitesv said in logging to different files via qInstallMessageHandler:
Is it possible to add some tag to 'log' method?
As @JonB already told you - the category is the tag where you can filter on.
@Christian-Ehrlicher said in logging to different files via qInstallMessageHandler:
As @JonB already told you - the category is the tag where you can filter on.
Your advice is to detect which exactly QFile will store a log by log category?
Very strange advice in my case... This assumes to 10 various log categories for 10 subclasses of MDI app.
-
Then filter by a keyword in the text. I don't see that your usecase could be handled easier with other logging systems...
-
S sitesv has marked this topic as solved on