Feature request #6964

QgsMessageLog, write to file

Added by Matthias Kuhn almost 5 years ago. Updated 26 days ago.

Status:Open
Priority:Normal
Assignee:-
Category:Unknown
Pull Request or Patch supplied:No Resolution:
Easy fix?:No

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

#1 Updated by Marco Hugentobler almost 5 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).

#2 Updated by Jürgen Fischer almost 5 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.

#3 Updated by Jürgen Fischer almost 5 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 ;)

#4 Updated by Matthias Kuhn almost 5 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.

#5 Updated by Jürgen Fischer almost 5 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.

#6 Updated by Jürgen Fischer almost 5 years ago

Jürgen Fischer wrote:

QgsLogger is used for debugging output.

And there's also QgsError/QgsErrorMessage

#7 Updated by Giovanni Manghi 6 months ago

  • Easy fix? set to No

#8 Updated by Jürgen Fischer 26 days ago

  • Category set to Unknown

Also available in: Atom PDF