These steps enable logging for Garbage Collector. By default the Garbage Collector logging is disabled.
To enable GC logging on NameNode:
Open the Hadoop Environment script,
%HADOOP_HOME%\etc\hadoop\hadoop-env.cmd
.Prepend the following text in the
HADOOP_NAMENODE_OPTS
definition:-Xloggc:%HADOOP_LOG_DIR%/gc-namenode.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps
For example:
set HADOOP_NAMENODE_OPTS=-Xloggc:%HADOOP_LOG_DIR%/gc-namenode.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Dhadoop.security.logger=%HADOOP_SECURITY_LOGGER% -Dhdfs.audit.logger=%HDFS_AUDIT_LOGGER% %HADOOP_NAMENODE_OPTS%
Run the following command to recreate the NameNode service XML:
%HADOOP_HOME%\bin\hdfs.cmd --service namenode > %HADOOP_HOME%\bin\namenode.xml
Verify that the NameNode Service XML was updated.
Restart the NameNode service.
The NameNode start up configuration is changed to enable GC logging.