Debugging Thunderbird Problems with Linux

Sometimes it can be hard to reproduce problems related to Email as many factors can be a cause for the trouble. Thunderbird (and all other Mozilla products) provide logging facilities which allow tracing the activities of the application and to detect the source of an error. The logging mechanism is activated by setting two environment variables as described in the documentation. The following two lines will set the environment

export NSPR_LOG_MODULES=imap:2,smpt:3,timestamp
export NSPR_LOG_FILE=/tmp/mail.log

Thunderbird reads these variables during startup and if the NSPR_LOG_MODULES is set, the application writes logging information into the file specified in NSPR_LOG_FILE. The logging module allows to specifiy which protocol you are interested in ( e.g. imap, smtp, pop etc) and also to provide a log level from (1 to 5, where 5 ist the most verbose). You can combine several protocols by seperating them with a comma. With the timestamp property set, the logger prints a timestamp next to each log message which allows easier tracing of the output. When you

You can use the tail command to read the output in real time.

tail -f /tmp/mail.log

Unfortunately there is a little catch which is not mentioned in the documentation as it is Linux distribution specific. When you installed Thunderbird manually (e.g. in /opt/), the log file remains empty and the mechanism does not seem to work. The solution is that you need to start thunderbird from its installation directory and not by its shortcut in /usr/bin. Thus changing to the right directory and then launching Thunderbird directly allows traceing the logs as described above

/opt/thunderbird/thunderbird &