打开Firefox的日志输出

应该说这个需求并不常见…但有时候我的确想过,要是能知道Firefox此时在干吗就好了–有那么几次,该运行的脚本没有运行,状态条显示页面的加载并未完成,但你却永远等不到它。

意外地是,谷哥和度娘似乎并不知道如何打开(turn on)Firefox的日志输出。万事通也有不灵的时候。几天以后,当我再次陷入强烈需要知道Firefox在干吗(或者是不是已经没干活了)的时候,呆呆地望着Firefox的标题栏,突然想起来,也许我应该使用how to turn on Mozilla logging去搜一下。果然。

要打开Firefox的日志输出,需要在启动它之前设置一些环境变量:

set NSPR_LOG_MODULES=all:5,timestamp,sync
set NSPR_LOG_FILE=C:\Users\Administrator\Desktop\firefox.log
cd "C:\Program Files (x86)\Mozilla Firefox"
.\firefox.exe
这里’all’表示对所有module都打开输出。目前我还没有得到模块列表,但似乎可以从log中看出来,那些在::之前的符号一般都可以当一个模块名使用。timestamp用来为每一行日志输出加上时间戳,这个使用的是UTC+0时间。sync意味着没有缓冲,直写硬盘。我会选择打开这一项,以便可以在某件事发生时,可以直接看到日志输出。

现在来看看日志输出的结果:

2011-10-05 10:09:19.309000 UTC - 0[933140]: DOCSHELL 7e8b200 InternalLoad http://www.tianya.cn/publicforum/content/itinfo/1/155142.shtml
2011-10-05 10:09:19.310000 UTC - 0[933140]: nsHttpHandler::NewChannel
2011-10-05 10:09:19.310000 UTC - 0[933140]: nsHttpHandler::NewProxiedChannel [proxyInfo=0]
2011-10-05 10:09:19.310000 UTC - 0[933140]: Creating HttpBaseChannel @53fe400
2011-10-05 10:09:19.310000 UTC - 0[933140]: Creating nsHttpChannel [this=53fe400]
2011-10-05 10:09:19.310000 UTC - 0[933140]: HttpBaseChannel::Init [this=53fe400]
2011-10-05 10:09:19.310000 UTC - 0[933140]: host=www.tianya.cn port=-1
2011-10-05 10:09:19.310000 UTC - 0[933140]: uri=http://www.tianya.cn/publicforum/content/itinfo/1/155142.shtml
2011-10-05 10:09:19.310000 UTC - 0[933140]: Creating nsHttpConnectionInfo @8ff99a0
2011-10-05 10:09:19.310000 UTC - 0[933140]: nsHttpChannel::Init [this=53fe400]
2011-10-05 10:09:19.311000 UTC - 0[933140]: nsHttpChannel::AsyncOpen [this=53fe400]
2011-10-05 10:09:19.311000 UTC - 0[933140]: nsHostResolver::ResolveHost [host=www.tianya.cn]
2011-10-05 10:09:19.311000 UTC - 0[933140]: DNS Thread Counters: total=1 any-live=0 idle=1 pending=1
2011-10-05 10:09:19.311000 UTC - 4860[9365c0]: resolving www.tianya.cn ...
2011-10-05 10:09:19.311000 UTC - 0[933140]: ===== COOKIE SENT =====
2011-10-05 10:09:19.311000 UTC - 0[933140]: request URL: http://www.tianya.cn/publicforum/content/itinfo/1/155142.shtml
2011-10-05 10:09:19.311000 UTC - 0[933140]: cookie string: __guid=2005099655; __ptime=1317807146341; __utma=82276233.2094948679.1317127188.1317706073.1317801108.7; __utmz=82276233.1317801108.7.6.utmccn=(referral)|utmcsr=my.tianya.cn|utmcct=/|utmcmd=referral; __visit=wpopa%3D9243%26subchannel%3Dfashion%26myty%3D1051; __guid2=2005099655; __gads=ID=c45a0d0447cf6604:T=1309419173:S=ALNI_Mb-zdoweISkGf7GwMvX3ovYCeQg8Q; historyitem=pfree-t170-t76-pfeeling-t762-pno11-t768-t972-pfuninfo; TIANYA_NAV_STATE=6%2C0%2C0%2C0%2C0%2C0%2C0; user=w=%u9521%u5a5a&id=21021299&f=1; temp=k=617682979&s=&t=1317125843&b=75524be7ef4ada6d0297d1b4f9ae52d4&ct=1317807144&et=1319717844&st=1ez0O0; sso=r=619092783&sid=&wsid=8E911A0B74DCBB312C89110D37CD30F4; right=web4=n&portal=n; temp4=rm=0fcbf78059274af792b9b7da5a43a40f; bbsclk=c%3D0%26o%3D0%26d%3D21021299; __cid=50; ASPSESSIONIDSCAABCCT=BNKLDDIADJPHLOKKPEEGNNGE; ASPSESSIONIDQADBBDDS=LHJKOHIADBIDDBDLLGCBKGDL; ASPSESSIONIDSCCDDBDT=JJCEOHIAMFGJJKKOLPJCKGFD; ASPSESSIONIDQCDACADR=ABANJNEBFKIMOMDMJDIANJEM; ASPSESSIONIDQSCAABCT=JEHEJKFBNBCCHGHNGFFLINJL; ASPSESSIONIDSQAABADT=LJNLMGHBPAMAHLCBHECOGPAM; ASPSESSIONIDSCQSSSAB=KCHJFFFBHGCAKNDPMOGGMODC; ASPSESSIONIDCQDADDCR=KGLJHDHBDDIBKNAJLBOLEKFJ; ASPSESSIONIDSSDBBBCT=HHCAAFIBNFHHIGECAKBNILHO; __utmc=82276233; my_tianya_msg=%5B%7B%22invite%22%3A0%2C%22total%22%3A0%2C%22sysmsg%22%3A0%2C%22msg%22%3A0%2C%22friend%22%3A0%2C%22retw%22%3A0%2C%22guestmsg%22%3A0%2C%22fans%22%3A0%2C%22sharetw%22%3A0%2C%22userId%22%3A21021299%7D%5D; ASPSESSIONIDAQADCDDR=IAIIKAACIHPKKOFPNNEJLDNI
2011-10-05 10:09:19.311000 UTC - 0[933140]: current time: Wed Oct 05 10:09:19 2011 GMT
2011-10-05 10:09:19.311000 UTC - 0[933140]:
2011-10-05 10:09:19.311000 UTC - 0[933140]: HttpBaseChannel::SetRequestHeader [this=53fe400 header="Cookie" value="__guid=2005099655; __ptime=1317807146341; __utma=82276233.2094948679.1317127188.1317706073.1317801108.7; __utmz=82276233.1317801108.7.6.utmccn=(referral)|utmcsr=my.tianya.cn|utmcct=/|utmcmd=referral; __visit=wpopa%3D9243%26subchannel%3Dfashion%26myty%3D1051; __guid2=2005099655; __gads=ID=c45a0d0447cf6604:T=1309419173:S=ALNI_Mb-zdoweISkGf7GwMvX3ovYCeQg8Q; historyitem=pfree-t170-t76-pfeeling-t762-pno11-t768-t972-pfuninfo; TIANYA_NAV_STATE=6%2C0%2C0%2C0%2C0%2C0%2C0; user=w=%u9521%u5a5a&id=21021299&f=1; temp=k=617682979&s=&t=1317125843&b=75524be7ef4ada6d0297d1b4f9ae52d4&ct=1317807144&et=1319717844&st=1ez0O0; sso=r=619092783&sid=&wsid=8E911A0B74DCBB312C89110D37CD30F4; right=web4=n&portal=n; temp4=rm=0fcbf78059274af792b9b7da5a43a40f; bbsclk=c%3D0%26o%3D0%26d%3D21021299; __cid=50; ASPSESSIONIDSCAABCCT=BNKLDDIADJPHLOKKPEEGNNGE; ASPSESSIONIDQADBBDDS=LHJKOHIADBIDDBDLLGCBKGDL; ASPSESSIONIDSCCDDBDT=JJCEOHIAMFGJJKKOLPJCKGFD; ASPSESSIONIDQCDACADR=ABANJNEBFKIMOMDMJDIANJEM; ASPSESSIONIDQSCAABCT=JEHEJKFBNBCCHGHNGFFLINJL; ASPSESSIONIDSQAABADT=LJNLMGHBPAMAHLCBHECOGPAM; ASPSESSIONIDSCQSSSAB=KCHJFFFBHGCAKNDPMOGGMODC; ASPSESSIONIDCQDADDCR=KGLJHDHBDDIBKNAJLBOLEKFJ; ASPSESSIONIDSSDBBBCT=HHCAAFIBNFHHIGECAKBNILHO; __utmc=82276233; my_tianya_msg=%5B%7B%22invite%22%3A0%2C%22total%22%3A0%2C%22sysmsg%22%3A0%2C%22msg%22%3A0%2C%22friend%22%3A0%2C%22retw%22%3A0%2C%22guestmsg%22%3A0%2C%22fans%22%3A0%2C%22sharetw%22%3A0%2C%22userId%22%3A21021299%7D%5D; ASPSESSIONIDAQADCDDR=IAIIKAACIHPKKOFPNNEJLDNI" merge=0]
2011-10-05 10:09:19.311000 UTC - 0[933140]: nsHttpHandler::NotifyObservers [chan=53fe430 event="http-on-modify-request"]
2011-10-05 10:09:19.312000 UTC - 4860[9365c0]: lookup complete for www.tianya.cn ...
2011-10-05 10:09:19.313000 UTC - 0[933140]: nsHttpHandler::NewURI
2011-10-05 10:09:19.313000 UTC - 0[933140]: nsHttpHandler::NewURI
2011-10-05 10:09:19.315000 UTC - 0[933140]: SecureUI:a7f1670: OnStateChange: progress: for toplevel
2011-10-05 10:09:19.316000 UTC - 0[933140]: SecureUI:a7f1670: OnStateChange
2011-10-05 10:09:19.316000 UTC - 0[933140]: SecureUI:a7f1670: 7e8b214 53fe430 OnStateChange f0001 http://www.tianya.cn/publicforum/content/itinfo/1/155142.shtml
2011-10-05 10:09:19.316000 UTC - 0[933140]: SecureUI:a7f1670: OnStateChange: SOMETHING STARTS FOR TOPMOST DOCUMENT
2011-10-05 10:09:19.316000 UTC - 0[933140]: SecureUI:a7f1670: OnStateChange: start for toplevel document
2011-10-05 10:09:19.316000 UTC - 0[933140]: SecureUI:a7f1670: OnStateChange: ++mDocumentRequestsInProgress
2011-10-05 10:09:19.317000 UTC - 0[933140]: nsHttpChannel::Connect [this=53fe400]
2011-10-05 10:09:19.317000 UTC - 0[933140]: nsHttpChannel::OpenCacheEntry [this=53fe400]
2011-10-05 10:09:19.317000 UTC - 0[933140]: nsHttpChannel::Suspend [this=53fe400]
2011-10-05 10:09:19.317000 UTC - 2720[beda200]: read -> 768
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHttpChannel::OnCacheEntryAvailable [this=53fe400 entry=9ea3d80 access=3 status=0]
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHttpChannel::Connect [this=53fe400]
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHTTPChannel::CheckCache enter [this=53fe400 entry=9ea3d80 access=3]
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHttpResponseHead::Parse [this=990d480]
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHttpResponseHead::ParseVersion [version=HTTP/1.1 200 OK]
2011-10-05 10:09:19.318000 UTC - 0[933140]: Have status line [version=11 status=200 statusText=OK]
2011-10-05 10:09:19.318000 UTC - 0[933140]: ParseContentType [type=text/html; Charset=gbk]
2011-10-05 10:09:19.318000 UTC - 0[933140]: Validating based on VALIDATE_ALWAYS load flag
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHTTPChannel::CheckCache exit [this=53fe400 doValidation=1]
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHttpChannelAuthProvider::AddAuthorizationHeaders? [this=8ff6590 channel=53fe564]
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHttpAuthCache::GetAuthEntryForPath [key=http://www.tianya.cn:-1 path=/publicforum/content/itinfo/1/]
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHttpChannel::SetupTransaction [this=53fe400]
2011-10-05 10:09:19.318000 UTC - 0[933140]: Creating nsHttpTransaction @62e9de0
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHttpTransaction::Init [this=62e9de0 caps=29]
2011-10-05 10:09:19.318000 UTC - 0[933140]: nsHttpTransaction::Init() mActivityDistributor is active this=62e9de0
2011-10-05 10:09:19.318000 UTC - 0[933140]: http request [
2011-10-05 10:09:19.318000 UTC - 0[933140]:   GET /publicforum/content/itinfo/1/155142.shtml HTTP/1.1
2011-10-05 10:09:19.318000 UTC - 0[933140]:   Host: www.tianya.cn
2011-10-05 10:09:19.318000 UTC - 0[933140]:   User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
2011-10-05 10:09:19.318000 UTC - 0[933140]:   Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
2011-10-05 10:09:19.318000 UTC - 0[933140]:   Accept-Language: zh-cn,zh;q=0.5
2011-10-05 10:09:19.318000 UTC - 0[933140]:   Accept-Encoding: gzip, deflate
2011-10-05 10:09:19.318000 UTC - 0[933140]:   Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
2011-10-05 10:09:19.318000 UTC - 0[933140]:   Connection: keep-alive
2011-10-05 10:09:19.318000 UTC - 0[933140]:   Referer: http://www.tianya.cn/bbs/index.shtml
2011-10-05 10:09:19.318000 UTC - 0[933140]:   Cookie: __guid=2005099655; __ptime=1317807146341; __utma=82276233.2094948679.1317127188.1317706073.1317801108.7; __utmz=82276233.1317801108.7.6.utmccn=(referral)|utmcsr=my.tianya.cn|utmcct=/|utmcmd=referral; __visit=wpopa%3D9243%26subchannel%3Dfashion%26myty%3D1051; __guid2=2005099655; __gads=ID=c45a0d0447cf6604:T=1309419173:S=ALNI_Mb-zdoweISkGf7GwMvX3ovYCeQg8Q; historyitem=pfree-t170-t76-pfeeling-t762-pno11-t768-t972-pfuninfo; TIANYA_NAV_STATE=6%2C0%2C0%2C0%2C0%2C0%2C0; user=w=%u9521%u5a5a&id=21021299&f=1; temp=k=617682979&s=&t=1317125843&b=75524be7ef4ada6d0297d1b4f9ae52d4&ct=1317807144&et=1319717844&st=1ez0O0; sso=r=619092783&sid=&wsid=8E911A0B74DCBB312C89110D37CD30F4; right=web4=n&portal=n; temp4=rm=0fcbf78059274af792b9b7da5a43a40f; bbsclk=c%3D0%26o%3D0%26d%3D21021299; __cid=50; ASPSESSIONIDSCAABCCT=BNKLDDIADJPHLOKKPEEGNNGE; ASPSESSIONIDQADBBDDS=LHJKOHIADBIDDBDLLGCBKGDL; ASPSESSIONIDSCCDDBDT=JJCEOHIAMFGJJKKOLPJCKGFD; ASPSESSIONIDQCDACADR=ABANJNEBFKIMOMDMJDIANJEM; ASPSESSIONIDQSCAABCT=JEHEJKFBNBCCHGHNGFFLINJL; ASPSESSIONIDSQAABADT=LJNLMGHBPAMAHLCBHECOGPAM; ASPSESSIONIDSCQSSSAB=KCHJFFFBHGCAKNDPMOGGMODC; ASPSESSIONIDCQDADDCR=KGLJHDHBDDIBKNAJLBOLEKFJ; ASPSESSIONIDSSDBBBCT=HHCAAFIBNFHHIGECAKBNILHO; __utmc=82276233; my_tianya_msg=%5B%7B%22invite%22%3A0%2C%22total%22%3A0%2C%22sysmsg%22%3A0%2C%22msg%22%3A0%2C%22friend%22%3A0%2C%22retw%22%3A0%2C%22guestmsg%22%3A0%2C%22fans%22%3A0%2C%22sharetw%22%3A0%2C%22userId%22%3A21021299%7D%5D; ASPSESSIONIDAQADCDDR=IAIIKAACIHPKKOFPNNEJLDNI
2011-10-05 10:09:19.318000 UTC - 0[933140]:   If-Modified-Since: Wed, 05 Oct 2011 08:23:03 GMT
2011-10-05 10:09:19.318000 UTC - 0[933140]:   Cache-Control: max-age=0
2011-10-05 10:09:19.318000 UTC - 0[933140]: ]

看上去这段日志请求了对www.tianya.cn的一个访问,并开始解析/bbs/index.shtml文件。

由于需要重启firefox,因此打开日志模式,重启firefox后,我先前的问题并没能得到重现。不过,知道如何打开Firefox的日志,相信仍然十分重要–特别是当你遇到特别棘手的问题时。当然,如果已经确定是Javascript的问题时,如果firebug不能帮助我们,还有DTrace可用。DTrace meets JavaScript (Brendan Gregg)给出了如何在Linux下通过DTrace来诊断跟Javascript相关的问题。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值