Community Articles

Find and share helpful community-sourced technical articles.
Labels (2)
avatar
Master Mentor

The below steps describe how to change the Namenode log level while logged on as hdfs with the below steps, without the need to restart the namenode

Get the current log level

$ hadoop daemonlog -getlevel {namenode_host}:50070BlockStateChange

Desired Output

Connecting to http://{namenode_host}:50070/logLevel?log=BlockStateChange 
SubmittedLogName:BlockStateChange
LogClass: org.apache.commons.logging.impl.Log4J
LoggerEffectiveLevel: INFO

Change to DEBUG

$ hadoop daemonlog -setlevel {namenode_host}:50070BlockStateChange DEBUG 

Desired Output

Connecting to http://{namenode_host}:50070/logLevel?log=BlockStateChange&level=DEBUG 
SubmittedLogName:BlockStateChange
LogClass: org.apache.commons.logging.impl.Log4J
LoggerSubmittedLevel: DEBUG 
SettingLevel to DEBUG ...
EffectiveLevel: DEBUG

Validate DEBUG mode

$ hadoop daemonlog -getlevel {namenode_host}:50070BlockStateChange

Desired Output

Connecting to http://{namenode_host}:50070/logLevel?log=BlockStateChange 
SubmittedLogName:BlockStateChange
LogClass: org.apache.commons.logging.impl.Log4J
LoggerEffectiveLevel: DEBUG

You should be able to notice the logging level in namenode.log has been updated, without restarting the service. After finishing your diagnostics you can reset the logging level back to INFO

Reset to INFO

$ hadoop daemonlog -setlevel {namenode_host}:50070BlockStateChange INFO 

Desired Output

Connecting to http://{namenode_host}:50070/logLevel?log=BlockStateChange&level=INFO 
SubmittedLogName:BlockStateChange
LogClass: org.apache.commons.logging.impl.Log4J
LoggerSubmittedLevel: INFO 
SettingLevel to INFO ...
EffectiveLevel: INFO 

Validate INFO

$ hadoop daemonlog -getlevel {namenode_host}:50070BlockStateChange

Output

Connecting to http://{namenode_host}:50070/logLevel?log=BlockStateChange 
SubmittedLogName:BlockStateChange
LogClass: org.apache.commons.logging.impl.Log4J
LoggerEffectiveLevel: INFO

Happy hadooping !!!!

2,854 Views
0 Kudos