nspr_log_modules.rst (2799B)
1 NSPR_LOG_MODULES 2 ================ 3 4 This environment variable specifies which log modules have logging 5 enabled. 6 7 8 Syntax 9 ------ 10 11 :: 12 13 moduleName:level[, moduleName:level]* 14 15 *moduleName* is the name specified in a 16 `:ref:`PR_NewLogModule` <http://www-archive.mozilla.org/projects/nspr/reference/html/prlog.html#25372>`__ 17 call or one of the handy magic names listed below. 18 19 *level* is a numeric value between 0 and 5, with the values having the 20 following meanings: 21 22 - 0 = PR_LOG_NONE: nothing should be logged 23 - 1 = PR_LOG_ALWAYS: important; intended to always be logged 24 - 2 = PR_LOG_ERROR: errors 25 - 3 = PR_LOG_WARNING: warnings 26 - 4 = PR_LOG_DEBUG: debug messages, notices 27 - 5: everything! 28 29 30 Description 31 ----------- 32 33 Specify a ``moduleName`` that is associated with the ``name`` argument 34 in a call to 35 `:ref:`PR_NewLogModule` <http://www-archive.mozilla.org/projects/nspr/reference/html/prlog.html#25372>`__ 36 and a non-zero ``level`` value to enable logging for the named 37 ``moduleName``. 38 39 Special log module names are provided for controlling NSPR's log service 40 at execution time. These controls should be set in the 41 :ref:`NSPR_LOG_MODULES` environment variable at execution time to affect 42 NSPR's log service for your application. 43 44 - **all** The name ``all`` enables all log modules. To enable all log 45 module calls to 46 ```PR_LOG`` <http://www-archive.mozilla.org/projects/nspr/reference/html/prlog.html#25497>`__, 47 set the variable as follows: 48 49 :: 50 51 set NSPR_LOG_MODULES=all:5 52 53 - **timestamp** Including ``timestamp`` results in a timestamp of the 54 form "2015-01-15 21:24:26.049906 UTC - " prefixing every logged line. 55 56 - **append** Including ``append`` results in log entries being appended 57 to the existing contents of the file referenced by NSPR_LOG_FILE. If 58 not specified, the existing contents of NSPR_LOG_FILE will be lost as 59 a new file is created with the same filename. 60 61 - **sync** The name ``sync`` enables unbuffered logging. This ensures 62 that all log messages are flushed to the operating system as they are 63 written, but may slow the program down. 64 65 - **bufsize:size** The name ``bufsize:``\ *size* sets the log buffer to 66 *size*. 67 68 Examples 69 -------- 70 71 Log everything from the Toolkit::Storage component that happens, 72 prefixing each line with the timestamp when it was logged to the file 73 /tmp/foo.log (which will be replaced each time the executable is run). 74 75 :: 76 77 set NSPR_LOG_MODULES=timestamp,mozStorage:5 78 set NSPR_LOG_FILE=/tmp/foo.log 79 80 .. _Logging_with_Try_Server: 81 82 Logging with Try Server 83 ----------------------- 84 85 - For **mochitest**, edit variable :ref:`NSPR_LOG_MODULES` in 86 ``testing/mochitest/runtests.py`` before pushing to try. You would be 87 able to download the log file as an artifact from the Log viewer. 88 - (other tests?)