Wednesday, May 1, 2013

Verbose Garbage Collection logging in the WebSphere Liberty Profile

As part of an exercise to help a colleague, who was trying to work out how to enable verbose GC logging within the WAS Liberty Profile, I've just installed Liberty and the WAS Developer Tools onto my Mac.

I used this excellent blog post: -


as inspiration, as well as an earlier blog post of mine: -


I downloaded Eclipse Indigo from the Eclipse site here into which I installed the WAS 8.5 Liberty Profile Developer Tools.

I also downloaded the Liberty code directly from here which resulted in: -

wlp-developers-8.5.0.2.jar

and installed it here: -

/Users/hayd/Downloads/wlp

I then referred to this IBM Technote: -

Setting generic JVM arguments in the WebSphere Application Server V8.5 Liberty profile

which directs one to create a jvm.options file, containing the line: -

-verbose:gc

There are two options for the location of this file - from the Technote: -

Depending on your preferences, you might configure a single JVM or all Liberty JVMs with your options file.

To apply these settings to a single server, save jvm.options at:

${server.config.dir}/jvm.options 

To apply these changes to all Liberty JVMs, save jvm.options at:

${wlp.install.dir}/etc/jvm.options

This will take effect for all JVMs that do not have a locally defined jvm.options file.

I found that, for the second of these - {wlp.install.dir}/etc/ -  I had to manually create the etc subdirectory here: -

/Users/hayd/Downloads/wlp/etc

Once I restarted my JVM: -

/Users/hayd/Downloads/wlp/bin/server stop MyInstance
/Users/hayd/Downloads/wlp/bin/server start MyInstance

I could see the Verbose GC data being logged: -

Launching MyInstance (wlp-1.0.2.cl0220130316-0213/websphere-kernel_1.0.2) on Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_21-b12 (en_US)
[AUDIT   ] CWWKE0001I: The server MyInstance has been launched.
[GC 24640K->6261K(94144K), 0.0080240 secs]
[GC 30901K->7789K(94144K), 0.0114560 secs]
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications. 
[GC 32429K->12040K(94144K), 0.0106580 secs]
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://localhost:9080/Pickle/*
[AUDIT   ] CWWKZ0001I: Application Pickle started in 0.92 seconds.
[ERROR   ] SRVE0164E: Web Application Pickle uses the context root /Pickle/*, which is already in use by Web Application Pickle. Web Application Pickle will not be loaded.
[AUDIT   ] CWWKZ0001I: Application PickleEAR started in 0.70 seconds.
[AUDIT   ] CWWKF0011I: The server MyInstance is ready to run a smarter planet.


here: -

/Users/hayd/Downloads/wlp/usr/servers/MyInstance/logs/console.log

I also tested placing the jvm.options file into the server.config.dir location instead: -

/Users/hayd/Downloads/wlp/usr/servers/MyInstance

and saw the same effect - verbose GC was enabled when I started the server.

Finally, this IBM Technote: -


was also of use to me in determining the precise location of the wlp.install.dir and shared.config.dir locations

No comments:

Post a Comment