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).
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:
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) ?