MailNews:Logging: Difference between revisions

Great reorg step 2 (mainly combine the two Thunderbird lists)
(Major reorganization (step 1) to focus on modern logging methods, add chat logging levels)
(Great reorg step 2 (mainly combine the two Thunderbird lists))
Line 8: Line 8:


Logging in recent years has evolved in:
Logging in recent years has evolved in:
* how logging is enabled, via command line or during run time in preferences
* how logging is enabled- possibilities include command line, and run time via Thunderbird preferences
* location of log data, either to a file, or to the Error Console
* location of log data - possibilities include a file, and Error Console


Futher, logging is possible via:
Futher, logging happens from one of two choices:
* [[[[MailNews:Logging#gecko_logging|Gecko logging]], which uses [[MailNews:Logging#Thunderibrd_Module_names|module names]]
* [[MailNews:Logging#gecko_logging|Gecko logging]], which uses [[MailNews:Logging#Thunderibrd_Module_names|module names]]
* [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]]
* [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]]
Thunderbird specific logging is enabled only via preferences. Gecko logging is enabled via preferences or command line.  For simplicity, we will not over all possible combinations in this document.


== Thunderbird Logging ==
== Thunderbird Logging ==


Thunderbird logging is disabled by default. Unless otherwise specified, logging is enabled by [[MailNews:Logging#setting_a_preference|setting a preference]] to <code>true</code>.  Unless otherwise specified, logging output goes to the Error Console, accessible at Tools > Developer > Error Console.
Modern logging is specified via Thunderbird preferences and output goes to the Error Console. Thunderbird logging is disabled by default. Unless otherwise specified, logging is enabled by [[MailNews:Logging#setting_a_preference|setting a preference]] to <code>true</code>.  Unless otherwise specified, logging output goes to the Error Console, accessible at Tools > Developer > Error Console.


=== Thunderbird Logging Types ===
=== Thunderbird Logging Types ===
Line 31: Line 29:
**  4  Show errors (PURPLE_DEBUG_ERROR)
**  4  Show errors (PURPLE_DEBUG_ERROR)
**  5  Show only fatal errors (PURPLE_DEBUG_FATAL)
**  5  Show only fatal errors (PURPLE_DEBUG_FATAL)
* Chat Off-The-Record (OTR) protocol for exchanging encrypted chat messages -  <code>chat.otr.trace</code> boolean preference
* Chat Off-The-Record (OTR) protocol for exchanging '''encrypted''' chat messages -  <code>chat.otr.trace</code> boolean preference
* [https://wiki.mozilla.org/Thunderbird:Debugging_Gloda Gloda Indexing (global search) activity to Error Console]
* [https://wiki.mozilla.org/Thunderbird:Debugging_Gloda Gloda Indexing (global search) activity to Error Console]
* ldap - <code>mailnews.ldap.loglevel</code> set to <code>All</code>
* NNTP - <code>mailnews.nntp.loglevel</code> set to <code>All</code>
* pop3 - <code>mailnews.pop3.loglevel</code> set to <code>All</code>
* smtp - <code>mailnews.smtp.loglevel</code> set to <code>All</code>


=== Setting a Preference ===
=== Setting a Preference ===


To configure logging via a Thunderbird Preference, you must create a hidden Thunderbird preference, not an environment variable. In Thunderbird do:
To configure logging via a Thunderbird Preference, you must create a hidden Thunderbird preference, not an environment variable. In Thunderbird :
# Settings > General  
# do Settings > General  
# in the search field type <code>config editor</code>
# in the search field type <code>config editor</code>
# click Config Editor
# click Config Editor
Line 44: Line 46:
# change the preferences's value to the desired logging value
# change the preferences's value to the desired logging value
#* for numeric preferences click the pencil icon, change the value, then click the check mark
#* for numeric preferences click the pencil icon, change the value, then click the check mark
#* for boolean preferences click the double headed arror to switch between <code>true</code> and </code>false</code>
#* for boolean preferences click the double headed arror to switch between <code>true</code> and <code>false</code>


To delete a preference, click the trash can.
To delete a preference, click the trash can.
Line 52: Line 54:
== Gecko Logging ==
== Gecko Logging ==


Thunderbird gets its "module" logging capabilities from Firefox core aka Gecko. whose logging capabilities are documented at https://firefox-source-docs.mozilla.org/xpcom/logging.html. The many modules available are listed in [https://searchfox.org/mozilla-central/search?q=LazyLogModule+.*%5C%28%22&path=&case=true&regexp=true this searchfox query]. Some examples:
Gecko logging is the classic method of getting log data. Gecko logging is enabled via preferences (not discussed in this document) or command line.
* nsHostResolver  (for DNS)
 
* GetAddrInfo  (for DNS)
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].  
* nsSocketTransport  (basic networking)


=== Thunderbird Module Names ===
=== Thunderbird Module Names ===
Line 61: Line 62:
All names are '''CASE SENSITIVE'''. Some relate to specific mail protocols.   
All names are '''CASE SENSITIVE'''. Some relate to specific mail protocols.   


# AbOutlookDirectory (before Thunderbird version 59: nsAbOutlookDirectoryLog)
# AbWinHelper (before Thunderbird version 59: nsAbWinHelperLog)
# BayesianFilter
# BayesianFilter
# CMS (for S/MIME)
# Filters
# Filters
# IMAP (more [[MailNews:Logging#Other_Protocol_Logging_options_within_MailNews|below]])
# IMAP (more [[MailNews:Logging#Other_Protocol_Logging_options_within_MailNews|below]])
# IMAP_CS (for CONDSTORE)
# IMAP_KW (for keyword (tag) processing)
# IMAPAutoSync (before Thunderbird version 59: ImapAutoSync)
# IMAPCache (for IMAP caching of messages in no-sync folders)
# IMAPOffline (before Thunderbird version 59: IMAPOFFLINE)
# IMAPOffline (before Thunderbird version 59: IMAPOFFLINE)
# ldap - [[MailNews:Logging#Setting_Thunderbird_Preference|Set preference]] mailnews.ldap.loglevel to "All". Open the Error Console with Ctrl+Shift+J or Command+Shift+J, add timestamp [1], and copy log entries. (Prior to Thunderbird 91 use "LDAP" module name. Before Thunderbird version 59 use all lower case "ldap".)   
# Import (before Thunderbird version 59: IMPORT)
# 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)
# MailDirStore
# MailDirStore
# MAPI
# MAPIAddressBook
# MIME
# MIME
# MsgBiff
# MsgBiff
Line 74: Line 85:
# 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)
# MsgPurge
# MsgPurge
# NNTP - [[MailNews:Logging#Setting_Thunderbird_Preference|Set preference]] mailnews.nntp.loglevel to "All". Open the Error Console with Ctrl+Shift+J or Command+Shift+J, add timestamp [1], and copy log entries. (Prior to Thunderbird 96 use "NNTP" module name.)
# NNTP <small>(After Thunderbird 95 use [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]])</small>
# pop3 - [[MailNews:Logging#Setting_Thunderbird_Preference|Set preference]] mailnews.pop3.loglevel to "All". Open the Error Console with Ctrl+Shift+J or Command+Shift+J, add timestamp [1], and copy log entries. (Prior to Thunderbird 99 use "POP3" module name.)
# pop3 <small>(After Thunderbird 98 use [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]])</small>
# smtp - [[MailNews:Logging#Setting_Thunderbird_Preference|Set preference]] mailnews.smtp.loglevel to "All". Open the Error Console with Ctrl+Shift+J or Command+Shift+J, add timestamp [1], and copy log entries. (Prior to Thunderbird 91 use "smtp" module name.)
# smtp <small>(After Thunderbird 90 use "[[MailNews:Logging#Thunderbird_logging|Thunderbird logging]])</small>


Notes:
Notes:
* [[MailNews:Logging#Other_Protocol_Logging_options_within_MailNews|Additional module choices are listed below]].
* The above list is fairly complete.  The full, current definitive list of modules is in [https://searchfox.org/comm-central/search?q=LazyLogModule+.*\(%22&path=&case=true&regexp=true this searchfox query].
* In version 59, {{bug|1353919}} changed these options to be mixed case. The old, inconsistent case options are in parenthesis.
* Potentially useful core Gecko modules not listed above: nsHostResolver (for DNS), GetAddrInfo (for DNS), nsSocketTransport (basic networking), negotiateauth (authentication)
* In version 59, {{bug|1353919}} changed these options to be mixed case. The old, inconsistent case options are shown above in parenthesis.
* [1] To expose timestamp in the Error Console, click the gear icon in top-right of the Error Console, turn on "Show Timestamps".
* [1] To expose timestamp in the Error Console, click the gear icon in top-right of the Error Console, turn on "Show Timestamps".
* Deprecated:
** Movemail
** AbOutlookDirFactory (before Thunderbird version 59: nsAbOutlookDirFactoryLog)
** WABAddressBook


=== Environment Variables to set ===
=== Environment Variables to set ===


'''NOTE - do not use this section for ldap, nntp, pop3 and smtp. They are configured in Thunderbird Settings, and log to the Thunderbird Error Console.''' Please refer to [[MailNews:Logging#Module_options_within_MailNews|module options]].
'''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. (Except for logging of ldap, nntp, pop3 and smtp, which are configured in Thunderbird settings and log to the Error Console - per instructions above. So you may ignore this section and the next for these protocols.) You can set these variables globally as system environment variables (find instructions for your OS), or as local environment variables in a batch file/script (described [[MailNews:Logging#Generating_a_Protocol_Log|below]]), or just on the command line.
Two variables must be set. (Except for logging of ldap, nntp, pop3 and smtp, which are configured in Thunderbird settings and log to the Error Console - per instructions above. So you may ignore this section and the next for these protocols.) You can set these variables globally as system environment variables (find instructions for your OS), or as local environment variables in a batch file/script (described [[MailNews:Logging#Generating_a_Protocol_Log|below]]), or just on the command line.
Line 104: Line 120:
=== Logging level ===
=== Logging level ===


'''NOTE - do not use this section for ldap, nntp, pop3 and smtp. They are configured in Thunderbird Settings, and log to the Thunderbird Error Console.''' Please refer to [[MailNews:Logging#Main_module_options_within_MailNews|module options]].
'''NOTE - do not use this section for ldap, nntp, pop3 and smtp. They are configured per [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]].


The number in MOZ_LOG specifies the level of logging to be used. A lower number reduces the amount of information being logged. Use "5" unless requested otherwise.
The number in MOZ_LOG specifies the level of logging to be used. A lower number reduces the amount of information being logged. Use "5" unless requested otherwise.
Line 145: Line 161:
  #!/bin/sh
  #!/bin/sh
  export MOZ_LOG=IMAP:5,timestamp
  export MOZ_LOG=IMAP:5,timestamp
  export MOZ_LOG_FILE=$HOME/imap.log
  export MOZ_LOG_FILE=$HOME/Desktop/imap.log
  /Applications/Thunderbird.app/Contents/MacOS/thunderbird-bin &amp;
  /Applications/Thunderbird.app/Contents/MacOS/thunderbird-bin &amp;


Line 181: Line 197:


To get a log for another protocol, replace "IMAP" with e.g. "MIME" in the above instructions.
To get a log for another protocol, replace "IMAP" with e.g. "MIME" in the above instructions.


=== 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 set a [[Mailnews:Logging#Setting_Thunderbird_Preference|Thunderbird preference]], not an environment variable, as described in the [[Mailnews:Logging#Main_module_options_within_MailNews|modules descriptions]].
* Are you logging ldap, nntp, pop3, or smtp? You must use [[MailNews:Logging#Thunderbird_logging|Thunderbird logging]], not an environment variable.
* 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 mailnews application?  (the log file is buffered in memory)
* Did you shut down the mailnews application?  (the log file is buffered in memory)
Line 194: Line 209:
* Are your log module names correctly '''CASE SENSITIVE'''?  (meaning mixed case, or camel case which is not all upper case, nor all lower case)
* Are your log module names correctly '''CASE SENSITIVE'''?  (meaning mixed case, or camel case which is not all upper case, nor all lower case)


== Other Protocol Logging options within MailNews ==
== NSPR Logging Options ==
 
The following modules may or may not be available in release builds, but are available in debug builds:
 
# CMS (for S/MIME)
# IMAPAutoSync (before Thunderbird version 59: ImapAutoSync)
# IMAP_CS (for CONDSTORE)
# IMAP_KW (for keyword (tag) processing)
# IMAPCache (for IMAP caching of messages in no-sync folders)
# Import (before Thunderbird version 59: IMPORT)
# MAPI
# MAPIAddressBook
# Movemail
# AbOutlookDirectory (before Thunderbird version 59: nsAbOutlookDirectoryLog)
# AbOutlookDirFactory (before Thunderbird version 59: nsAbOutlookDirFactoryLog)
# AbWinHelper (before Thunderbird version 59: nsAbWinHelperLog)
# WABAddressBook
# negotiateauth (Mozilla core option)
 
The full list of modules available are listed in [https://searchfox.org/comm-central/search?q=LazyLogModule+.*\(%22&path=&case=true&regexp=true this searchfox query].
 
 
== More NSPR Logging Options =


Miscellaneous [http://www.mozilla.org/projects/nspr/reference/html/prlog.html NSPR Reference (logging)].
NSPR also has logging.  Miscellaneous [http://www.mozilla.org/projects/nspr/reference/html/prlog.html NSPR Reference (logging)].


== Enhancement Ideas ==  
== Enhancement Ideas ==  
canmove, Confirmed users
2,239

edits