I want to read and copypaste the error log for the crashes I am experiencing in QGIS 2.0. The error I am getting freezes QGIS so I have to ctrl-alt-del. I can see the last message in the panel, but can't copy it or scroll back to see the earlier messages. When I re-open it, the log message panel has reset to zero (QGIS starting, etc), so all the transform error messages I want are gone.

Are the older log messages written to disk somewhere?

4 Answers 4


QGIS does not write its log messages to a file by default.

If you have a debug build (nightlies normally are) they are written to stdout. That means that if you run it in a terminal on linux you will see the messages there. On Windows I think there is a tool called Debugging Tools for Windows or similar that can intercept the messages.

An alternative is to use some minimal python scripting. Every message is emitted as a Qt signal. Therefore we can connect to these signals and write them to a file. Simply copy the following command to your python console

For QGIS 3:

from qgis.core import QgsApplication

filename = '/tmp/qgis.log'

def write_log_message(message, tag, level):
    with open(filename, 'a') as logfile:
        logfile.write('{tag}({level}): {message}'.format(tag=tag, level=level, message=message))


Or for QGIS 2:

filename = '/tmp/qgis.log'

def write_log_message(message, tag, level):
    with open(filename, 'a') as logfile:
        logfile.write('{tag}({level}): {message}'.format(tag=tag, level=level, message=message))


When you run this code, the output will be written to /tmp/qgis.log.

  • There should be a blank line between the end of the function definition and the final line for the Python console to be happy with the copy/paste
    – raphael
    Jan 13, 2017 at 17:29
  • NameError: name 'QgsMessageLog' is not defined Dec 5, 2023 at 10:49
  • @swiss_knight are you using QGIS 2 or QGIS3? Dec 6, 2023 at 6:54
  • @MatthiasKuhn QGIS 3.28 or 3.34. I was told that this snippet has to be run inside the QGIS Python console. This was not clear when I was first reading your message as it is not explicitly written. But I don't see any error messages in that hand-made log file when my QGIS definitely freezes when opening a project. So I'm not able to debug it properly. Dec 16, 2023 at 11:45
  • I added the import to the instructions for QGIS 3, this way it can be run from any python environment in QGIS. The error above looks very much like it's being caused by using the QGIS 2 snippet, QgsMessageLog is not used in the QGIS 3 version. In any case, there is no guarantee that QGIS will write something into the log in a specific moment, e.g. when freezing. Dec 18, 2023 at 17:44

While this won't help with this particular problem, if you just want to see the logs during runtime (i.e. QGIS is not crashing), you can enable the Log Messages panel.

In QGIS Go to: View>Panels>Log Messages

Make sure the box is checked.

  • 12
    Please read the question one more time.
    – Stefan
    Oct 6, 2015 at 10:01
  • 2
    How do you get back the tabs in the log messages panel if you lose a couple?
    – user32882
    Sep 4, 2018 at 8:52
  • 1
    +1 as this is the correct answer. The comment about Stackexchange community is out of line though. Mar 6, 2019 at 20:42
  • 1
    @GrzegorzOledzki no, the question explicitely asks persistent logs. Log messages only shows those during this runtime.
    – inc42
    Jan 5, 2020 at 13:42

Processing => Options

You need to check this : 'Keep dialog open after running an algorithm'

after that you can copy past the error log

enter image description here


Might sound obvious, but I've found it useful to make the QGIS messages box a floating dialogue so that you can extend it from top to bottom of your screen. This would allow you to see and print screen more messages when QGIS crashes. Sorry, I don't know where QGIS writes these messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.