第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

java9之后的log

標(biāo)簽:
Java

java9之后log框架改变了。很多gc日志的参数也变了。设置新的参数,往往有点不知所措。
下面就介绍一下新日志的模式。
样例

java -Xlog:gc*=info Main
[0.011s][info][gc,heap] Heap region size: 1M
[0.014s][info][gc     ] Using G1
[0.014s][info][gc,heap,coops] Heap address: 0x0000000700000000, size: 4096 MB, Compressed Oops mode: Zero based, Oop shift amount: 3
[0.188s][info][gc,heap,exit ] Heap
[0.188s][info][gc,heap,exit ]  garbage-first heap   total 262144K, used 2048K [0x0000000700000000, 0x0000000800000000)
[0.188s][info][gc,heap,exit ]   region size 1024K, 3 young (3072K), 0 survivors (0K)
[0.188s][info][gc,heap,exit ]  Metaspace       used 6238K, capacity 6394K, committed 6528K, reserved 1056768K
[0.188s][info][gc,heap,exit ]   class space    used 544K, capacity 574K, committed 640K, reserved 1048576K


大家可以看到这样的日志似乎变化特别大。
下面是设置的规范

-Xlog[:[selections][:[output][:[decorators][:output-options]]]]

其实设置和使用比原来是简单很多了。使用就几个模块,可能比较麻烦的是找出这些模块。我们下面一个一个看模块。

selections

selections主要是两部分组成,tags和levels。
我们案例里设置的

gc*=info

tag就是gc*,level就是info。

level不写默认就是info。他有以下几种选择,分别代表不同程度的日志,

off, trace, debug, info, warning, error

tag的种类比较多

 add, age, alloc, annotation, aot, arguments, attach, barrier, biasedlocking, blocks, bot, breakpoint, bytecode, cds, census, class, classhisto, cleanup, codecache, compaction, compilation, constantpool, constraints, container, coops, cpu, cset, data, datacreation, dcmd, decoder, defaultmethods, director, dump, ergo, event, exceptions, exit, fingerprint, free, freelist, gc, handshake, hashtables, heap, humongous, ihop, iklass, init, inlining, interpreter, itables, jfr, jit, jni, jvmti, liveness, load, loader, logging, malloc, mark, marking, membername, memops, metadata, metaspace, methodcomparator, mirror, mmu, module, monitorinflation, monitormismatch, nestmates, nmethod, normalize, objecttagging, obsolete, oldobject, oom, oopmap, oops, oopstorage, os, pagesize, parser, patch, path, perf, phases, plab, preorder, preview, promotion, protectiondomain, purge, redefine, ref, refine, region, reloc, remset, resolve, safepoint, sampling, scavenge, setting, smr, stackmap, stacktrace, stackwalk, start, startuptime, state, stats, stringdedup, stringtable, subclass, survivor, sweep, system, table, task, thread, time, timer, tlab, tracking, unload, unshareable, update, verification, verify, vmoperation, vmthread, vtables, vtablestubs, workgang

其实平时用不到这么多,想看的时候可以找出想要的配置上就好。
tag的表达

-Xlog:gc

表示只包含gc标签的,例如

[0.014s][info][gc     ] Using G1
-Xlog:gc*

表示至少包含gc的log,例如gc还有gc和heap的组合。

[0.011s][info][gc,heap] Heap region size: 1M
[0.014s][info][gc     ] Using G1

tag也可以组合

-Xlog:gc,os

用逗号表示或,筛选出只包含gc或者只包含os的。

[0.003s][info][os] Use of CLOCK_MONOTONIC is supported
[0.003s][info][os] Use of pthread_condattr_setclock is not supported
[0.003s][info][os] Relative timed-wait using pthread_cond_timedwait is associated with the default clock
[0.003s][info][os] SafePoint Polling address, bad (protected) page:0x000000010e2bd000, good (unprotected) page:0x000000010e2be000
[0.015s][info][gc] Using G1
-Xlog:gc+heap

用加号表示且,包含gc和heap的日志

[0.010s][info][gc,heap] Heap region size: 1M

特殊用法,利用off的level可以筛选

-Xlog:gc*=info,coops*=off

这里至少包含gc,不能包含coops。会在最初的记录里,去掉了含有coops的记录。

output

out有三种选择。

 stdout
 stderr
 file=

不写默认是stdout。

decorators

decorator就是日志前面的时间,标签等的输出

 time (t), utctime (utc), uptime (u), timemillis (tm), uptimemillis (um), timenanos (tn), uptimenanos (un), hostname (hn), pid (p), tid (ti), level (l), tags (tg)

只要编写decorator,就可以修改日志的输出顺序,以及输出的前面的部分。
默认是

uptime,levels,tags

output-options

filesize
filecount

这里就是控制文件大小和个数的。

點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
JAVA開(kāi)發(fā)工程師
手記
粉絲
1.6萬(wàn)
獲贊與收藏
380

關(guān)注作者,訂閱最新文章

閱讀免費(fèi)教程

  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消