NSPR LOG MODULES 编辑

This environment variable specifies which log modules have logging enabled.

Syntax

moduleName:level[, moduleName:level]*

moduleName is the name specified in a PR_NewLogModule call or one of the handy magic names listed below.

level is a numeric value between 0 and 5, with the values having the following meanings:

  • 0 = PR_LOG_NONE: nothing should be logged
  • 1 = PR_LOG_ALWAYS: important; intended to always be logged
  • 2 = PR_LOG_ERROR: errors
  • 3 = PR_LOG_WARNING: warnings
  • 4 = PR_LOG_DEBUG: debug messages, notices
  • 5: everything!

Description

Specify a moduleName that is associated with the name argument in a call to PR_NewLogModule and a non-zero level value to enable logging for the named moduleName

Special log module names are provided for controlling NSPR's log service at execution time. These controls should be set in the NSPR_LOG_MODULES environment variable at execution time to affect NSPR's log service for your application. 

  • all The name all enables all log modules. To enable all log module calls to PR_LOG, set the variable as follows:
    set NSPR_LOG_MODULES=all:5
  • timestamp Including timestamp results in a timestamp of the form "2015-01-15 21:24:26.049906 UTC - " prefixing every logged line.
  • append Including append results in log entries being appended to the existing contents of the file referenced by NSPR_LOG_FILE.  If not specified, the existing contents of NSPR_LOG_FILE will be lost as a new file is created with the same filename.
  • sync The name sync enables unbuffered logging.   This ensures that all log messages are flushed to the operating system as they are written, but may slow the program down.
  • bufsize:size The name bufsize:size sets the log buffer to size.

Examples

Log everything from the Toolkit::Storage component that happens, prefixing each line with the timestamp when it was logged to the file /tmp/foo.log (which will be replaced each time the executable is run).

set NSPR_LOG_MODULES=timestamp,mozStorage:5
set NSPR_LOG_FILE=/tmp/foo.log

Logging with Try Server

  • For mochitest, edit variable NSPR_LOG_MODULES in testing/mochitest/runtests.py before pushing to try. You would be able to download the log file as an artifact from the Log viewer.
  • (other tests?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:50 次

字数:3616

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文