canmove, Confirmed users
2,215
edits
m (→Introduction: switch the order of logging types) |
(improve gecko logging instructions) |
||
| Line 52: | Line 52: | ||
To delete a preference, click the trash can. | To delete a preference, click the trash can. | ||
It is not necessary to restart Thunderbird - logging starts immediately. You can view the output in the Error Console. | It is not necessary to restart Thunderbird - logging starts immediately. | ||
You can view the output at Tools > Developer > Error Console. To expose timestamp, click the gear icon in top-right of the Error Console, turn on "Show Timestamps". | |||
== Gecko Logging == | == Gecko Logging == | ||
Gecko logging is the classic method of getting log data. Gecko logging is enabled via preferences (not discussed in this document) or command line. | Gecko logging using module names is the classic method of getting log data. Gecko logging is enabled via preferences (not discussed in this document) or command line. | ||
Thunderbird gets its | Thunderbird gets its module logging capabilities from Firefox core aka Gecko. Gecko logging capabilities are thoroughly documented in this [https://firefox-source-docs.mozilla.org/xpcom/logging.html excellent reference]. | ||
=== Thunderbird Module Names === | === Thunderbird Module Names === | ||
All names are '''CASE SENSITIVE'''. | All names are '''CASE SENSITIVE'''. | ||
# AbOutlookDirectory (before Thunderbird version 59: nsAbOutlookDirectoryLog) | # AbOutlookDirectory (before Thunderbird version 59: nsAbOutlookDirectoryLog) | ||
| Line 72: | Line 74: | ||
# IMAP_CS (for CONDSTORE) | # IMAP_CS (for CONDSTORE) | ||
# IMAP_KW (for keyword (tag) processing) | # IMAP_KW (for keyword (tag) processing) | ||
# IMAPAutoSync (before Thunderbird version 59: ImapAutoSync) | # IMAPAutoSync <small>(before Thunderbird version 59: ImapAutoSync)</small> | ||
# IMAPCache (for IMAP caching of messages in no-sync folders) | # IMAPCache (for IMAP caching of messages in no-sync folders) | ||
# IMAPOffline (before Thunderbird version 59: IMAPOFFLINE) | # IMAPOffline <small>(before Thunderbird version 59: IMAPOFFLINE)</small> | ||
# Import (before Thunderbird version 59: IMPORT) | # Import <small>(before Thunderbird version 59: IMPORT)</small> | ||
# ldap <small>(After Thunderbird 90 use [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]])</small> | # ldap <small>(After Thunderbird 90 use [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]])</small> | ||
# Mailbox (before Thunderbird version 59: MAILBOX) | # Mailbox (before Thunderbird version 59: MAILBOX) | ||
| Line 83: | Line 85: | ||
# MIME | # MIME | ||
# MsgBiff | # MsgBiff | ||
# MsgCompose (before Thunderbird version 59: msgcompose) | # MsgCompose <small>(before Thunderbird version 59: msgcompose)</small> | ||
# MsgCopyService <small>(3.3a4 nightly builds starting 5/2/2011)</small> | # MsgCopyService <small>(3.3a4 nightly builds starting 5/2/2011)</small> | ||
# MsgDB <small>(level 1=opens/closes, level 5 lists open db's on close, number of msg hdrs in use)</small> (before Thunderbird version 59: MSGDB) | # MsgDB <small>(level 1=opens/closes, level 5 lists open db's on close, number of msg hdrs in use)</small> (before Thunderbird version 59: MSGDB) | ||
| Line 92: | Line 94: | ||
Notes: | Notes: | ||
* The | * The current, full list of Thunderbird module names is seen in [https://searchfox.org/comm-central/search?q=LazyLogModule+.*\(%22&path=&case=true®exp=true this searchfox query]. (which includes Firefox-specific and Core module names) | ||
* | * Gecko modules potentially useful to Thunderbird users: | ||
* | ** nsHostResolver (for DNS) | ||
** GetAddrInfo (for DNS) | |||
** nsSocketTransport (basic networking) | |||
** negotiateauth (authentication) | |||
* Version 59 {{bug|1353919}} changed these options to be mixed case. The old, inconsistent case options are in parenthesis above. | |||
* Deprecated: | * Deprecated: | ||
** Movemail | ** Movemail | ||
| Line 105: | Line 110: | ||
'''NOTE - do not use this section for ldap, nntp, pop3 and smtp. They are configured per [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]]. | '''NOTE - do not use this section for ldap, nntp, pop3 and smtp. They are configured per [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]]. | ||
Two variables must be set | Two variables must be set, '''MOZ_LOG''' and '''MOZ_LOG_FILE''' as local environment variables in a batch file/script (described [[MailNews:Logging#Generating_a_Gecko_Log|below]]) or on a command line. (using global system environment variables is not recommended) | ||
==== MOZ_LOG_FILE ==== | |||
'''MOZ_LOG_FILE''' is the path and file name to the log file. An extension of '''.moz_log''' will be added to the file name (since Thunderbird 70). If MOZ_LOG_FILE is not set, then the output will be logged to the console where the application was launched. | |||
Note: | Note: | ||
* The log file is written over every time you re-launch the | * The log file is written over every time you re-launch the application. | ||
* If you are running multiple | * If you are running multiple applications, such as Firefox and Thunderbird, then these applications may stomp on each other in the log, or even wipe out the other's log entries. Avoid this by running only one application at a time. | ||
* You must have write access to the directory of the log file. | * You must have write access to the directory of the log file. | ||
=== Logging level === | ==== MOZ_LOG ==== | ||
'''MOZ_LOG''' syntax is a list of terms, separated by commas. There are two types of terms: | |||
* A '''CASE SENSITIVE''' module name and its [[MailNews:Logging#Logging_level|log level]], separated by a colon (:), such as '''example_module:5''' to enable the module example_module at logging level 5 (verbose). | |||
* Optional special strings (switches) to configure the logging behaviour. Some configuration switches take an integer parameter, in which case the integer is separated from the string by a colon (:). Most switches only apply in a specific output context. Full documentation at [https://firefox-source-docs.mozilla.org/xpcom/logging.html#the-moz-log-syntax]. | |||
Example module and loglevel: '''IMAPAutoSync:5,timestamp''' | |||
''',timestamp''' adds a timestamp to all log lines - generally recommended, and required for all timeouts and issues which need to be correlated to an action at a given time of day | |||
===== Logging level ===== | |||
'''NOTE - do not use this section for ldap, nntp, pop3 and smtp. They are configured per [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]]. | '''NOTE - do not use this section for ldap, nntp, pop3 and smtp. They are configured per [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]]. | ||
| Line 133: | Line 144: | ||
* 5 = Verbose /* A message that will be printed a lot, useful for debugging program flow and will probably impact performance. */ | * 5 = Verbose /* A message that will be printed a lot, useful for debugging program flow and will probably impact performance. */ | ||
<small>Some modules may not work exactly according to the log levels noted above. Very few modules actually have more than one logging level</small> | <small>Some modules may not work exactly according to the log levels noted above. Very few modules actually have more than one logging level.</small> | ||
=== Generating a Gecko Log === | === Generating a Gecko Log === | ||
| Line 143: | Line 154: | ||
Create a batch file by copying the lines below and paste them into the notepad application, and save the file as "create_imap_log.bat". Variables MOZ_LOG and MOZ_LOG_file must not contain quotation marks. | Create a batch file by copying the lines below and paste them into the notepad application, and save the file as "create_imap_log.bat". Variables MOZ_LOG and MOZ_LOG_file must not contain quotation marks. | ||
set MOZ_LOG= | set MOZ_LOG=moduleName:5,timestamp | ||
set MOZ_LOG_FILE=%USERPROFILE%\Desktop\ | set MOZ_LOG_FILE=%USERPROFILE%\Desktop\log_file | ||
"%ProgramFiles(x86)%\Mozilla Thunderbird\thunderbird.exe" | "%ProgramFiles(x86)%\Mozilla Thunderbird\thunderbird.exe" | ||
* | * '''On versions with User Account Control (UAC), the batch file must be run with administrator privileges.''' Right click on the batch file and select "Run as administrator". Otherwise the log file will not be created and no UAC warnings will be generated. | ||
* XP and Vista users should specify %ProgramFiles% instead of %ProgramFiles(x86)% (which is for Windows 7) - assuming Thunderbird was installed to it's default location. | * XP and Vista users should specify %ProgramFiles% instead of %ProgramFiles(x86)% (which is for Windows 7) - assuming Thunderbird was installed to it's default location. | ||
Now run the batch file. The example puts the log file on your desktop: | Now run the batch file. The example puts the log file on your desktop: | ||
| Line 162: | Line 172: | ||
#!/bin/sh | #!/bin/sh | ||
export MOZ_LOG= | export MOZ_LOG=moduleName:5,timestamp | ||
export MOZ_LOG_FILE=$HOME/Desktop/ | export MOZ_LOG_FILE=$HOME/Desktop/log_file | ||
/Applications/Thunderbird.app/Contents/MacOS/thunderbird-bin & | /Applications/Thunderbird.app/Contents/MacOS/thunderbird-bin & | ||
| Line 170: | Line 180: | ||
Save this file with a filename ending in .command, add execute permission by typing "<tt>chmod a+x ''filename''</tt>" in a Terminal window, then double-click it. | Save this file with a filename ending in .command, add execute permission by typing "<tt>chmod a+x ''filename''</tt>" in a Terminal window, then double-click it. | ||
Alternatively, you can setup a file so that the protocol tracing will always be in effect. (Not recommended if you use both Firefox and Thunderbird) To do this open a Terminal window, cd into the .MacOSX directory under your login directory and create a file named <tt>environment.plist</tt> containing the following. Non-unix users can use the "pico" editor which I think is available on OS X by default:<br> | |||
Alternatively, you can setup a file so that the protocol tracing will always be in effect. To do this open a Terminal window, cd into the .MacOSX directory under your login directory and create a file named <tt>environment.plist</tt> containing the following. Non-unix users can use the "pico" editor which I think is available on OS X by default:<br> | |||
<pre><?xml version="1.0" encoding="UTF-8"?> | <pre><?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| Line 178: | Line 186: | ||
<dict> | <dict> | ||
<key>MOZ_LOG_FILE</key> | <key>MOZ_LOG_FILE</key> | ||
<string>/tmp/ | <string>/tmp/log_file.txt</string> | ||
<key>MOZ_LOG</key> | <key>MOZ_LOG</key> | ||
<string> | <string>moduleName:5,timestamp</string> | ||
</dict> | </dict> | ||
</plist> | </plist> | ||
| Line 191: | Line 199: | ||
# For bash shell (the default shell on most GNU/Linux systems): | # For bash shell (the default shell on most GNU/Linux systems): | ||
export MOZ_LOG= | export MOZ_LOG=moduleName:5,timestamp | ||
export MOZ_LOG_FILE=/tmp/ | export MOZ_LOG_FILE=/tmp/log_file | ||
# For tcsh / csh (which is not as common): | # For tcsh / csh (which is not as common): | ||
setenv MOZ_LOG | setenv MOZ_LOG moduleName:5,timestamp | ||
setenv MOZ_LOG_FILE /tmp/ | setenv MOZ_LOG_FILE /tmp/log_file | ||
=== Missing Log File === | === Missing Log File === | ||
If your log file is empty or missing, review this document again, and check for these common problems: | If your log file is empty or missing, review this document again, and check for these common problems: | ||
* Are you logging ldap, nntp, pop3, or smtp? You must use [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]], not | * Are you logging ldap, nntp, pop3, or smtp? You must use [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]], not Gecko module logging using environment variables. | ||
* Do you have write access to the directory specified in MOZ_LOG_FILE? | * Do you have write access to the directory specified in MOZ_LOG_FILE? | ||
* Did you shut down the | * Did you shut down the application? (the log file is buffered in memory until the application is closed) | ||
* Did you restart your mailnews application, and wipe out the log of the session you wanted to debug? (every restart wipes out the previous log) | * Did you restart your mailnews application, and wipe out the log of the session you wanted to debug? (every restart wipes out the previous log) | ||
* If you used a batch file on Windows, is the batch file set to run with administrator privileges? | * If you used a batch file on Windows, is the batch file set to run with administrator privileges? | ||