Feature request #6964

QgsMessageLog, write to file

Added by Matthias Kuhn about 4 years ago. Updated about 4 years ago.

Status:Open Start Date:01/08/2013
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:-
Target version:Future Release - Nice to have
Platform: Resolution:
Platform version: Pull Request or Patch supplied:No
Status info: Tag:

Description

To be really useful, QgsMessageLog should include a possibility to write the log messages to a file.

Per default, only log level Error (and higher, is there higher?) should be written to the log file.
The debug console should receive Warning and higher per default.

It should be possible to configure both to receive other message levels.

Maybe it would be nice to integrate with syslog, journald etc. although this is not considered priority.

History

Updated by Marco Hugentobler about 4 years ago

Writing message logs to file would be nice for QGIS server too (better error reporting if e.g. a layer cannot be loaded).

Updated by Jürgen Fischer about 4 years ago

Marco Hugentobler wrote:

Writing message logs to file would be nice for QGIS server too (better error reporting if e.g. a layer cannot be loaded).

QgsMessageLog should already be prepared to do that. QgisApp registers the log viewer to handle the log in the gui, otherwise it would go to the console and that's probably also where the messages from mapserver go - if that's not enough you could implement a new class for mapserver. There it would make sense to include support for syslog. For the desktop case that doesn't make much sense - IMHO.

Updated by Jürgen Fischer about 4 years ago

There currently is only one used warning level - you can use other levels, but when I introduces the message log, I didn't bother to classify each and every message ported to the log. And meanwhile no one else did either ;)

Updated by Matthias Kuhn about 4 years ago

I just noticed the class QgsLogger (implmented by Marco) which seems to do some kind of file logging already.
Is it possible to remove one of them?
Without having a closer look at QgsLogger I'd say that QgsMessageLog seems to be more modular and should be able to replace QgsLogger once file logging backend is included.

Updated by Jürgen Fischer about 4 years ago

Matthias Kuhn wrote:

I just noticed the class QgsLogger (implmented by Marco) which seems to do some kind of file logging already. Is it possible to remove one of them? Without having a closer look at QgsLogger I'd say that QgsMessageLog seems to be more modular and should be able to replace QgsLogger once file logging backend is included.

QgsLogger is used for debugging output.

Updated by Jürgen Fischer about 4 years ago

Jürgen Fischer wrote:

QgsLogger is used for debugging output.

And there's also QgsError/QgsErrorMessage

Also available in: Atom