To enable logging, change the settings in the hadoop-env.cmd
file. After modifying hadoop-env.cmd, recreate the NameNode
service XML and then restart the NameNode.
To enable audit logging, change the hdfs.audit.logger value
to INFO,RFAAUDIT. Overwrite the NameNode service XML and restart
the NameNode.
Open the Hadoop Environment script,
%HADOOP_HOME%\etc\hadoop\hadoop- env.cmd.Prepend the following text in the
HADOOP_NAMENODE_OPTSdefinition, for example to enable Garbage Collection logging:-Xloggc:%HADOOP_LOG_DIR%/gc-namenode.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStampsFor 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 --service namenode > %HADOOP_HOME%\bin\namenode.xmlVerify that the NameNode Service XML was updated.
Restart the NameNode service.

