Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Migration of gc log parameters in java9

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "the migration of gc log parameters in java9". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the migration of gc log parameters in java9".

Order

This paper mainly studies the migration of java9 gc log parameters.

Unified Logging of JVM and GC

Java9 introduces a unified logging framework that includes gc-related log output and configuration.

Related JEP (JDK Enhancement Proposal)

JEP 158: Unified JVM Logging

JEP 264: Platform Logging API and Service

JEP 271: Unified GC Logging

Xlog syntax

-Xlog [: option] option: = [] [:]] 'help'' disable' what: = [,...] Selector: = [*] [=] tag-set: = [+...] 'all' tag: = name of tag level: = trace debug info warning error output: =' stderr' 'stdout' [file=] decorators: = [,...] 'none' decorator: = time uptime timemillis uptimemillis timenanos uptimenanos pid tid level tags output-options: = [,...] Output-option: = filecount= filesize= parameter=value

What

Mainly configure tag and level

Tag

Where all represents all tag, the others are as follows:

Add,age,alloc,annotation,aot,arguments,attach,barrier,biasedlocking,blocks,bot,breakpoint,bytecode,census,class,classhisto,cleanup,compaction,comparator,constraints,constantpool,coops,cpu,cset,data,defaultmethods,dump,ergo,event,exceptions,exit,fingerprint,freelist,gc,hashtables,heap,humongous,ihop,iklass,init,itables,jfr,jni,jvmti,liveness,load,loader,logging,mark,marking,metadata,metaspace,method,mmu,modules,monitorinflation,monitormismatch,nmethod,normalize,objecttagging,obsolete,oopmap,os,pagesize,parser,patch Path,phases,plab,preorder,promotion,protectiondomain,purge,redefine,ref,refine,region,remset,resolve,safepoint,scavenge,scrub,setting,stackmap,stacktrace,stackwalk,start,startuptime,state,stats,stringdedup,stringtable,subclass,survivor,sweep,system,task,thread,time,timer,tlab,unload,update,verification,verify,vmoperation,vtables,workgang

Level

The main score is off,trace,debug,info,warning,error

Output

-stdout (`Sends output to stdout`)-stderr (`Sends output to stderr`)-file=filename (`Sends output to text file (s) `)

If you specify file, you can use the% p variable to represent the pid of the current jvm and the% t to represent the startup timestamp of the jvm. such as

-Xlog:gc:demoapp-gc-%p-%t.log

The file name of the output is as follows:

Demoapp-gc-1678-2018-03-01 21-44-18.log

Decorators

Time-Current time and date in ISO-8601 format

Uptime-Time since the start of the JVM in seconds and milliseconds (e.g.6.567s)

Timemillis-- The same value as generated by System.currentTimeMillis ()

Uptimemillis-Milliseconds since the JVM started

Timenanos-- The same value as generated by System.nanoTime ()

Uptimenanos-Nanoseconds since the JVM started

Pid-The process identifier

Tid-The thread identifier

Level-The level associated with the log message

Tags-The tag-set associated with the log message

If not specified, the default is uptime, level, and and tags. such as

[3.080s] [info] [gc,cpu] GC (5) User=0.03s Sys=0.00s Real=0.01s

Example

-Xlog:gc=trace:file=gctrace.txt:uptimemillis,pid:filecount=5,filesize=1024

Tag is gc,levle, trace,rotate is 5 files, each file is 1m, and the file name is gctrace.txt,decrotators, uptimemillis and pid.

Output instance

[1110ms] [1867] GC (2) Pause Remark 17M-> 17m (256m) 2.024ms [1110ms] [1867] GC (2) Finalize Live Data 0.000ms [1110ms] [1867] GC (2) Pause Cleanup 17M-> 17m (256m) 0.177ms [1112ms] [1867] GC (2) Concurrent Cycle 7.470ms [2951ms] [1867] GC (3) Pause Initial Mark (Metadata GC Threshold) 149m-> 30m (256m) 27.175ms [2951ms] [1867] GC (4) Concurrent Cycle [2972ms] [1867] GC ( 4) Pause Remark 32M-> 32m (256m) 5.132ms [2974ms] [1867] GC (4) Finalize Live Data 0.000ms [2974ms] [1867] GC (4) Pause Cleanup 32M-> 32m (256m) 0.214ms [2976ms] [1867] GC (4) Concurrent Cycle 25.422ms Migration

Migration of parameters related to the old GC

Legacy Garbage Collection (GC) FlagXlog ConfigurationCommentG1PrintHeapRegions-Xlog:gc+region=traceNot ApplicableGCLogFileSizeNo configuration availableLog rotation is handled by the framework.NumberOfGCLogFilesNot ApplicableLog rotation is handled by the framework.PrintAdaptiveSizePolicy-Xlog:ergo*=levelUse a level of debug for most of the information Or a level of trace for all of what was logged for PrintAdaptiveSizePolicy.PrintGC-Xlog:gcNot ApplicablePrintGCApplicationConcurrentTime-Xlog:safepointNote that PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime are logged on the same tag and aren't separated in the new logging.PrintGCApplicationStoppedTime-Xlog:safepointNote that PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime are logged on the same tag and not separated in the new logging.PrintGCCauseNot ApplicableGC cause is now always logged.PrintGCDateStampsNot ApplicableDate stamps are logged by the framework.PrintGCDetails-Xlog:gc*Not ApplicablePrintGCIDNot ApplicableGC ID is now always logged.PrintGCTaskTimeStamps-Xlog:task*=debugNot ApplicablePrintGCTimeStampsNot ApplicableTime stamps are logged by the framework.PrintHeapAtGC-Xlog:gc+heap=traceNot ApplicablePrintReferenceGC-Xlog:ref*=debugNote that in the old logging PrintReferenceGC had an effect only if PrintGCDetails was also enabled.PrintStringDeduplicationStatistics-Xlog:stringdedup*=debugNot ApplicablePrintTenuringDistribution-Xlog:age*=levelUse a level of debug for the most relevant information, or a level of trace for all of what was logged for PrintTenuringDistribution.UseGCLogFileRotationNot ApplicableWhat was logged for PrintTenuringDistribution.

Migration of old runtime parameters

Legacy Runtime FlagXlog ConfigurationCommentTraceExceptions-Xlog:exceptions=infoNot ApplicableTraceClassLoading-Xlog:class+load=levelUse level=info for regular information, or level=debug for additional information. In Unified Logging syntax,-verbose:class equals-Xlog:class+load=info,class+unload=info.TraceClassLoadingPreorder-Xlog:class+preorder=debugNot ApplicableTraceClassUnloading-Xlog:class+unload=levelUse level=info for regular information, or level=trace for additional information. In Unified Logging syntax,-verbose:class equals-Xlog:class+load=info,class+unload=info.VerboseVerification-Xlog:verification=infoNot ApplicableTraceClassPaths-Xlog:class+path=infoNot ApplicableTraceClassResolution-Xlog:class+resolve=debugNot ApplicableTraceClassInitialization-Xlog:class+init=infoNot ApplicableTraceLoaderConstraints-Xlog:class+loader+constraints=infoNot ApplicableTraceClassLoaderData-Xlog:class+loader+data=levelUse level=debug for regular information or level=trace for additional information.TraceSafepointCleanupTime-Xlog:safepoint+cleanup=infoNot ApplicableTraceSafepoint-Xlog:safepoint=debugNot ApplicableTraceMonitorInflation-Xlog:monitorinflation=debugNot ApplicableTraceBiasedLocking-Xlog:biasedlocking=levelUse level=info for regular information, or level=trace for additional information.TraceRedefineClasses-Xlog:redefine+class*=levellevel=info, = debug, and = trace provide increasing amounts of information. Summary

Java9 unifies the selection and output of gc log into Xlog, which can be migrated according to the official migration table.

Thank you for your reading, the above is the content of "the transfer of gc log parameters in java9". After the study of this article, I believe you have a deeper understanding of the migration of gc log parameters in java9, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report