我在我的一个应用程序中使用Java 1.8。如何强制GC以纯文本格式输出日志而不是XML格式?
请查看下面提到的日志类型,以及我的期望。
观察日志:
<exclusive-start id="2" timestamp="2018-06-18T01:41:50.395" intervalms="26599.320">
<response-info timems="0.014" idlems="0.014" threads="0" lastid="0000000001FE3700" lastname="main" />
</exclusive-start>
<af-start id="3" threadId="0000000001FE4060" totalBytesRequested="40232" timestamp="2018-06-18T01:41:50.395" intervalms="26599.466" type="nursery" />
<cycle-start id="4" type="scavenge" contextid="0" timestamp="2018-06-18T01:41:50.396" intervalms="26600.656" />
<gc-start id="5" type="scavenge" contextid="4" timestamp="2018-06-18T01:41:50.397">
<mem-info id="6" free="803864072" total="1073741824" percent="74">
<mem type="nursery" free="0" total="268435456" percent="0">
<mem type="allocate" free="0" total="134217728" percent="0" />
<mem type="survivor" free="0" total="134217728" percent="0" />
</mem>
<mem type="tenure" free="803864072" total="805306368" percent="99">
<mem type="soa" free="763599368" total="765041664" percent="99" />
<mem type="loa" free="40264704" total="40264704" percent="100" />
</mem>
<remembered-set count="21177" />
</mem-info>
</gc-start>
渴望的日志:
34.927: [GC [PSYoungGen: 146575K->21818K(152896K)] 146575K->31648K(502464K), 0.1226880 secs] [Times: user=0.11 sys=0.02, real=0.12 secs]
38.705: [GC [PSYoungGen: 152890K->21817K(152896K)] 162720K->72539K(502464K), 1.6407590 secs] [Times: user=0.27 sys=0.05, real=1.64 secs]
45.687: [GC [PSYoungGen: 138376K->21812K(85056K)] 189099K->73548K(434624K), 0.2931950 secs] [Times: user=0.11 sys=0.00, real=0.29 secs]