Weblogic: GC Log Generation

 
 

weblogic
This post covers about GC log generation that is Garbage collection log generation in WebLogic and is must read if you are learning WebLogic.

We cover this GC log generation topic in our Oracle WebLogic Training with other topics (such as creating WebLogic domain, managed servers, clustering,deployment, logging, JMS, JTA, JDBC, JMX or security, Performance tuning and Troubleshooting).

GC Log Generation

 

1. Make java file by using below steps.

vi TestJavaGCLogging.java

2. Write below sample code in TestJavaGCLogging.java file.

package com.test;

import java.util.Map;
import java.util.HashMap;

public class TestJavaGCLogging {

/**
* @param args
*/
public static void main(String[] args) {
Map<Integer, Object> objectMap = new HashMap<Integer, Object>();

for (int i = 0; i < 5000000; i++) {
Object obj = new Object();
objectMap.put(i, obj);
}

System.out.println(“MAP size: ” + objectMap.size());
System.gc();

for (int i = 0; i < 5000000; i++) {
Object obj = new Object();
objectMap.put(i, obj);
}

System.out.println(“MAP size: ” + objectMap.size());
System.gc();

for (int i = 0; i < 5000000; i++) {
Object obj = new Object();
objectMap.put(i, obj);
}

System.out.println(“MAP size: ” + objectMap.size());
System.gc();

}
}

3. Compile your java program by using below command.

 javac TestJavaGCLogging.java

4. Execute your java program by using below command.

java TestJavaGCLogging.java

  Output:

[GC (Allocation Failure)  61164K->57832K(251392K), 0.0982666 secs]
[GC (Allocation Failure)  115498K->115328K(316928K), 0.1344700 secs]
[GC (Allocation Failure)  231564K->238464K(371200K), 0.2023053 secs]
[Full GC (Ergonomics)  238464K->213428K(593408K), 1.5529075 secs]
[GC (Allocation Failure)  344500K->376196K(659456K), 0.1887039 secs]
[Full GC (Ergonomics)  376196K->326801K(907776K), 1.7682597 secs]
MAP size: 5000000
[GC (System.gc())  346187K->345753K(972800K), 0.0677305 secs]
[Full GC (System.gc())  345753K->345580K(972800K), 2.3864599 secs]
MAP size: 5000000
[GC (System.gc())  505471K->423852K(1006592K), 0.2583115 secs]
[Full GC (System.gc())  423852K->345580K(1006592K), 2.8451946 secs]
MAP size: 5000000
[GC (System.gc())  501868K->423860K(1006592K), 0.2246933 secs]
[Full GC (System.gc())  423860K->345580K(1006592K), 1.8027748 secs]

 

If you want to learn more on WebLogic like above or wish to discuss challenges you are hitting in Oracle WebLogic Server, register for our Oracle WebLogic Administration Training.

We are so confident on quality and value of our training that We provide 100% Money back guarantee so in unlikely case of you being not happy after 2 sessions, just drop us a mail before third session and We’ll refund FULL money.

Did you subscribe to our YouTube Channel (435 already subscribed) and Private FaceBook Group (666 Members) ?

Series Navigation<< opatch, adpatch and now “smart update” (BSU) to apply weblogic patches

Share This Post with Your Friends over Social Media!

This entry is part 7 of 6 in the series WebLogic Server

About the Author AppsDBA

Leave a Comment:

[i]
[i]