java gc loggc_java9中gc log参数迁移
序
本文主要研究一下java9 gc log参数的迁移。
统一JVM及GC的Logging
java9引进了一个统一的日志框架,把gc相关的log输出及配置也给纳入进来了。
相关JEP(JDK Enhancement Proposal)
Xlog语法
-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
主要是配置tag及level
tag
其中all代表所有的tag,其他的如下:
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
主要分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)`)
有如上三种,其中指定file的话,可以使用%p变量表示当前jvm的pid,用%t表示jvm的启动时间戳。比如
-Xlog:gc:demoapp-gc-%p-%t.log
输出的文件名如下:
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
不指定的话,默认是uptime,level,and tags这三个。比如
[3.080s][info][gc,cpu ] GC(5) User=0.03s Sys=0.00s Real=0.01s
实例
-Xlog:gc=trace:file=gctrace.txt:uptimemillis,pid:filecount=5,filesize=1024
tag为gc,levle为trace,rotate文件数为5,每个文件1M,文件名为gctrace.txt,decrotators为uptimemillis和pid
输出实例
[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
迁移
旧版GC相关参数迁移
Legacy Garbage Collection (GC) Flag
Xlog Configuration
Comment
G1PrintHeapRegions
-Xlog:gc+region=trace
Not Applicable
GCLogFileSize
No configuration available
Log rotation is handled by the framework.
NumberOfGCLogFiles
Not Applicable
Log rotation is handled by the framework.
PrintAdaptiveSizePolicy
-Xlog:ergo*=level
Use a level of debug for most of the information,or a level of trace for all of what was logged for PrintAdaptiveSizePolicy.
PrintGC
-Xlog:gc
Not Applicable
PrintGCApplicationConcurrentTime
-Xlog:safepoint
Note that PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime are logged on the same tag and aren't separated in the new logging.
PrintGCApplicationStoppedTime
-Xlog:safepoint
Note that PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime are logged on the same tag and not separated in the new logging.
PrintGCCause
Not Applicable
GC cause is now always logged.
PrintGCDateStamps
Not Applicable
Date stamps are logged by the framework.
PrintGCDetails
-Xlog:gc*
Not Applicable
PrintGCID
Not Applicable
GC ID is now always logged.
PrintGCTaskTimeStamps
-Xlog:task*=debug
Not Applicable
PrintGCTimeStamps
Not Applicable
Time stamps are logged by the framework.
PrintHeapAtGC
-Xlog:gc+heap=trace
Not Applicable
PrintReferenceGC
-Xlog:ref*=debug
Note that in the old logging,PrintReferenceGC had an effect only if PrintGCDetails was also enabled.
PrintStringDeduplicationStatistics
-Xlog:stringdedup*=debug
Not Applicable
PrintTenuringDistribution
-Xlog:age*=level
Use a level of debug for the most relevant information,or a level of trace for all of what was logged for PrintTenuringDistribution.
UseGCLogFileRotation
Not Applicable
What was logged for PrintTenuringDistribution.
旧版运行时参数迁移
Legacy Runtime Flag
Xlog Configuration
Comment
TraceExceptions
-Xlog:exceptions=info
Not Applicable
TraceClassLoading
-Xlog:class+load=level
Use 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=debug
Not Applicable
TraceClassUnloading
-Xlog:class+unload=level
Use level=info for regular information,or level=trace for additional information. In Unified Logging Syntax,class+unload=info.
VerboseVerification
-Xlog:verification=info
Not Applicable
TraceClassPaths
-Xlog:class+path=info
Not Applicable
TraceClassResolution
-Xlog:class+resolve=debug
Not Applicable
TraceClassInitialization
-Xlog:class+init=info
Not Applicable
TraceLoaderConstraints
-Xlog:class+loader+constraints=info
Not Applicable
TraceClassLoaderData
-Xlog:class+loader+data=level
Use level=debug for regular information or level=trace for additional information.
TraceSafepointCleanupTime
-Xlog:safepoint+cleanup=info
Not Applicable
TraceSafepoint
-Xlog:safepoint=debug
Not Applicable
TraceMonitorInflation
-Xlog:monitorinflation=debug
Not Applicable
TraceBiasedLocking
-Xlog:biasedlocking=level
Use level=info for regular information,or level=trace for additional information.
TraceRedefineClasses
-Xlog:redefine+class*=level
level=info,=debug,and =trace provide increasing amounts of information.
小结
java9把gc log的选型及输出也给统一到了Xlog中,可以按照官方给出的迁移表进行迁移。
总结
以上是编程之家为你收集整理的java9中gc log参数迁移全部内容,希望文章能够帮你解决java9中gc log参数迁移所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您喜欢交流学习经验,点击链接加入交流1群:1065694478(已满)交流2群:163560250
java gc loggc_java9中gc log参数迁移相关推荐
- java+jvm+log_java9 gc log参数迁移
序 本文主要研究一下java9 gc log参数的迁移. 统一JVM及GC的Logging java9引进了一个统一的日志框架,把gc相关的log输出及配置也给纳入进来了. 相关JEP(JDK Enh ...
- java9 gc log参数迁移_个人文章 - SegmentFault 思否
序 本文主要研究一下java9 gc log参数的迁移. 统一JVM及GC的Logging java9引进了一个统一的日志框架,对gc log的输出进行了统一的配置. 相关JEP(JDK Enhanc ...
- 两图说明 java 开发工具中启动类参数都是干嘛的
开发工具中启动类参数都是干嘛的? 之前经常在开发工具中见到配置启动类参数,但从来不清楚是干啥的.实际中在搭建环境中VM options 配置信息比较常见.主要为了设置一些配置信息,比如dubbo的一些 ...
- Java导出excel中response.setHeader()参数设置
response.setHeader() 1. HTTP消息头 (1)通用信息头 即能用于请求消息中,也能用于响应信息中,但与被传输的实体内容没有关系的信息头,如Data,Pragma 主要: Cac ...
- 【Android Gradle 插件】gradle.properties 中配置编译参数并在 Java 代码 BuildConfig 中调用该参数
文章目录 一.gradle.properties 中配置编译参数 二.在 build.gradle 中配置 BuildConfig.java 生成信息 三.编译后生成的 BuildConfig 类 A ...
- java在注解中绑定方法参数的解决方案
我们有这样子的需求,需要记录用户操作某个方法的信息并记录到日志里面,例如,用户在保存和更新任务的时候,我们需要记录下用户的ip,具体是保存还是更新,调用的是哪个方法,保存和更新的任务名称以及操作是否成 ...
- Java笔记-JNI中简单的参数与返回值处理
目录 基本概念 代码及演示 基本概念 此篇博文记录了JNI的基本规范,与使用: https://blog.csdn.net/qq78442761/article/details/94849374 在本 ...
- Java笔记-Spring-rabbitmq中设置receiveMessage参数为Message
如下代码: public void receiveMessage(Message message){............ } 其中对应的Message为此包: import org.springf ...
- java gc堆中的分区_jvm内存各个区域详解
内存区域划分 Java虚拟机所管理的内存区域分为如下部分:方法区.GC堆.虚拟机栈.本地方法栈.PC程序计数器. 其中方法区.GC堆是所有线程共享的:虚拟机栈.本地方法栈.PC程序计数器是各个线程独占 ...
- java中GC的基本概念
GC Java中一个接口的多个实现类所需要的内存可能不一样,一个方法中的多个分支需要的内存也可能不一样,我们只有在程序处于运行期间时才会知道创建了哪些对象,这部分内存的分配时动态的,而程序计数器.虚拟 ...
最新文章
- python统计特定类型文件数量_分享一些常见的Python编程面试题及答案
- 怎么监控一个接口的传输数据_监控安装超详细教学教程,学会又多一门技能
- 如何在 JS 代码中消灭 for 循环
- java 虚拟机 新生代与老年代gc_java 虚拟机--新生代与老年代GC
- plt.errorbar画误差曲线
- L1-010. 比较大小-PAT团体程序设计天梯赛
- 使用Docker Swarm来运行服务
- RabbitMQ的问题
- 算法工程师必备技能(Python 优化提速小技巧)
- android中期检查表,基于Android的车载视频播控系统的中期检查表.docx
- Java 生成二维码名片(Springboot)
- [一步一步MVC]第四回:漫谈ActionLink,有时“胡搅蛮缠”
- Linux——进程管理(crontab实例傻瓜教程)
- 计算机怎样关闭电脑桌面弹窗,永久关闭电脑弹窗广告的三种方法
- CSS 变形(CSS3) transform
- 再练动态规划——(2)自然数拆分Lunatic版
- 树莓派3 之 USB摄像头安装和使用
- win 10专业版激活
- 计算机类科技创新项目课题,计算机学院第八期科技创新基金项目申报通知
- 如何写好一篇技术论文