WAS發生heapdump時隨之還產生了javacore和Snap.***.trc文件
Snap.***.trc文件無法直接查看,需要對其進行格式化,就算用文本編輯器打開看見的也是有很多亂碼

跟蹤格式化器(trace formatter) 是一個可以在任何平台上運行的 Java 程序,可以對來自任何平台的跟蹤文件進行格式化。
IBM SDK 在 core.jar 中提供了這個格式化器,它還需要一個稱為 TraceFormat.dat 的文件,其中包含格式化模板。這個文件在 jre/lib 中。
可以用以下命令行啟動跟蹤格式化器:
[java] view plain copy
- <span style=”font-size:14px;”>java com.ibm.jvm.format.TraceFormat input_file [output_file]</span>
在這裡,com.ibm.jvm.format.TraceFormat 是跟蹤格式化器類,input_file 是要進行格式化的二進位跟蹤文件的名稱,output_file 是可選的輸出文件名。如果沒有指定輸出文件,那麼默認的輸出文件名是輸入文件名加上 .fmt。
具體實例命令如下:
[java] view plain copy
- C:\Users\Administrator>cd D:\WebSphere\AppServer\java\bin
- C:\Users\Administrator>d:
- D:\WebSphere\AppServer\java\bin>java com.ibm.jvm.format.TraceFormat D:\WebSphere\AppServer\profiles\AppSrv04\Snap.143231.10516.0001.trc
- *** Starting data extraction from binary trace file(s)
- *** Locating formatting template files
- *** Found D:\WebSphere\AppServer\java\jre\lib\J9TraceFormat.dat
- *** Found D:\WebSphere\AppServer\java\jre\lib\TraceFormat.dat
- *** Loading further formatting templates from D:\WebSphere\AppServer\java\jre\lib\TraceFormat.dat
- *** Extracting 89buffers from D:\WebSphere\AppServer\profiles\AppSrv04\Snap.143231.10516.0001.trc
- *** Sorting buffers
- *** Starting formatting of entries into text file D:\WebSphere\AppServer\profiles\AppSrv04\Snap.143231.10516.0001.trc.fmt
- *** Number of traced threads = 89
- 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
- *** Number of formatted tracepoints = 17114
- *** Formatting complete
- *** Formatted output written to file: D:\WebSphere\AppServer\profiles\AppSrv04\Snap.143231.10516.0001.trc.fmt
- 0errors were detected during formatting
- D:\WebSphere\AppServer\java\bin>
Snap.***.trc文件格式化之後就可以使用文本編輯器查看
以下文章點擊率最高
Loading…