Setting Hadoop Service Log Levels at Runtime

You can dynamically change the log levels of Hadoop services (such as YARN and HDFS) using the hadoop daemonlog command without needing to restart the services.

Key Notes

  1. Ports: Replace <host:port> with the admin/HTTP port of the service (not the web UI port).
  2. Class Names: Use the fully qualified class name of the service’s main class (e.g., org.apache.hadoop.yarn.server.resourcemanager.ResourceManager).
  3. Log Levels: Supported levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL.
  4. Ensure that the mentioned commands on this page are executed by the user running the respective process. For NameNode-related operations, specifically use the NN service keytab and the hdfs user to initialize the Kerberos token before running the command.
  5. Persistence: Changes are temporary and reset after service restart. For permanent changes, modify log4j.properties and restart the service.

YARN Services

Resource Manager

  • Get Current Log Level
Bash
Copy

The example output is as follows.

Bash
Copy
  • Set Log Level to Debug
Bash
Copy

The example output is as follows.

Bash
Copy

Node Manager

  • Get Current Log Level
Bash
Copy

The example output is as follows.

Bash
Copy
  • Set Log Level to WARN
Bash
Copy

The example output is as follows.

Bash
Copy

HDFS Services

NameNode

  • Get Log Level
Bash
Copy

The example output is as follows.

Bash
Copy
  • Set Log Level to Error
Bash
Copy

The example output is as follows.

Bash
Copy

DataNode

  • Get Log Level
Bash
Copy

The example output is as follows.

Bash
Copy
  • Set Log Level to Debug
Bash
Copy

The example output is as follows.

Bash
Copy

Other Services

MapReduce JobHistory Server

  • Set Log Level
Bash
Copy

The example output is as follows.

Bash
Copy

Timeline Server

  • Set Log Level
Bash
Copy

The example output is as follows.

Bash
Copy

Verification

  • Check logs in real-time
Bash
Copy
  • Confirm log level updates
Bash
Copy

Example Summary

ServiceCommand (Set to Debug)
ResourceManagerhadoop daemonlog -setlevel rm-host:8088 org.apache.hadoop.yarn.server.resourcemanager.ResourceManager DEBUG
NodeManagerhadoop daemonlog -setlevel nm-host:8042 org.apache.hadoop.yarn.server.nodemanager.NodeManager DEBUG
NameNodehadoop daemonlog -setlevel nn-host:9870 org.apache.hadoop.hdfs.server.namenode.NameNode DEBUG

For HTTPS clusters, add -protocol https to the command.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated