MailNews:Logging: Difference between revisions
(→Specifying Environment Variables to Thunderbird/SeaMonkey: Migrating some getting a protocol log instructions) |
(correct sample environment variables) |
||
Line 23: | Line 23: | ||
# NSPR_LOG_MODULES - Module name and level separated by colon | # NSPR_LOG_MODULES - Module name and level separated by colon | ||
#* Example: "ldap:5 | #* Example: "imap:5" | ||
#* Example: "ldap:5,smtp:3"<p> | |||
# NSPR_LOG_FILE - Path to the log file | # NSPR_LOG_FILE - Path to the log file | ||
#* If NSPR_LOG_FILE is not set, then the output will be logged to the console where the application was launched. | #* If NSPR_LOG_FILE is not set, then the output will be logged to the console where the application was launched. |
Revision as of 18:52, 16 October 2008
The MailNews logging mechanism is activated by setting two environment variables before running a MailNews application.
Main Logging options within MailNews
The following modules/protocols may be logged within MailNews applications (SeaMonkey/Thunderbird) in both debug and release builds:
- mime
- imap
- nntp
- smtp
- pop3
- ldap
Environment Variables to set
Two environment variables should set:
- NSPR_LOG_MODULES - Module name and level separated by colon
- Example: "imap:5"
- Example: "ldap:5,smtp:3"
- NSPR_LOG_FILE - Path to the log file
- If NSPR_LOG_FILE is not set, then the output will be logged to the console where the application was launched.
On all platforms, the log is written over every time you re-launch the mozilla application.
Logging level
The number in the NSPR_LOG_MODULES example above specifies the level of logging to be used. A lower number reduces the amount of information that is logged to the file:
- PR_LOG_NONE = 0, /* nothing */
- PR_LOG_ALWAYS = 1, /* always printed */
- PR_LOG_ERROR = 2, /* error messages */
- PR_LOG_WARNING = 3, /* warning messages */
- PR_LOG_DEBUG = 4, /* debug messages */
Some modules may not work exactly according to the log levels noted above.
Generating a Protocol Log
Windows
There are various ways to set the environment variables for protocol logging. One is to create a batch file e.g. "create_imap_log.bat" with the following lines:
set NSPR_LOG_MODULES=imap:5 set NSPR_LOG_FILE=c:\tmp\imap.log "C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
To get a log for another protocol, replace "imap" with e.g. "smtp" or "pop3" in the above instructions.
When you want to run Thunderbird/SeaMonkey with logging, just run the batch file. You can double click it, create a shortcut to it, move it into your start menu, or run it from a command prompt or the start>run dialog.
The above commands can also be executed directly in the command prompt. (On Windows 2000, XP, 2003 Server: Start>Programs>Accessories>Command Prompt.)
Mac
To generate an IMAP protocol log, create a text file that contains the desired commands in a text editor such as BBEdit:
#!/bin/sh export NSPR_LOG_MODULES=imap:5 export NSPR_LOG_FILE=imap.log /Applications/Thunderbird.app/Contents/MacOS/thunderbird-bin &
Save this file with a filename ending in .command, then double-click it.
To get a log for another protocol, replace "imap" with e.g. "smtp" or "pop3" in the above instructions.
Linux/unix
To generate an IMAP protocol log, run the following commands before running the application from the command line:
# For bash shell (the default shell on most GNU/Linux systems): export NSPR_LOG_MODULES=imap:5 export NSPR_LOG_FILE=/tmp/imap.log
# For tcsh / csh (which is not as common): setenv NSPR_LOG_MODULES imap:5 setenv NSPR_LOG_FILE /tmp/imap.log
To get a log for another protocol, replace "imap" with e.g. "smtp" or "pop3" in the above instructions.
TODO (More migration).
See MailNews troubleshooting for details.
Reference Documents
- NSPR Reference (logging)
- MailNews troubleshooting
- Comment on bug about how to add timestamps to logs on windows
Other Protocol Logging options within MailNews
The following modules may or may not be available in release builds, but are available in debug builds:
- imapoffline
- bayesianfilter
- msgcompose
- mapi
- nsaboutlookcardlog
- nsabwinhelperlog
- ldapautocomplete
- nswabaddressbook
- nsaboutlookdirectorylog
- movemail
- msgbiff
- msgpurge
- appleimportlog
- import