-
Notifications
You must be signed in to change notification settings - Fork 76
build: unify Hadoop logging through Log4j2 and expose /actuator/loggers #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cbb330
wants to merge
7
commits into
linkedin:main
Choose a base branch
from
cbb330:chbush/unify-logging-log4j2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
91a6a69
docs: clarify PUT table requirements for baseTableVersion and tablePr…
cbb330 a81f51f
build: unify Hadoop logging through Log4j2 by removing slf4j-log4j12
cbb330 0e01cc1
build: bump log4j-1.2-api to 2.25.3 to match log4j-core
cbb330 ea4603a
build: exclude log4j-slf4j-impl and add log4j-slf4j2-impl for SLF4J 2.x
cbb330 dca7c3e
tables: remove redundant management.endpoint.loggers.enabled (default…
cbb330 1a6308f
scripts: add enable-hdfs-debug.sh for runtime HDFS/Iceberg log level …
cbb330 88f37ef
build: scope logging unification and keep fixtures neutral
cbb330 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # enable-hdfs-debug.sh — Enable HDFS/Iceberg debug logging on a local OpenHouse cluster. | ||
| # | ||
| # Targets the tables-service running via: | ||
| # ./gradlew dockerUp -Precipe=oh-hadoop | ||
| # | ||
| # Sets DEBUG on the key Hadoop, HDFS, and Iceberg loggers via the Spring Boot | ||
| # Actuator /actuator/loggers endpoint at runtime. No restart required. | ||
| # | ||
| # Usage: | ||
| # ./scripts/enable-hdfs-debug.sh # Enable DEBUG logging | ||
| # ./scripts/enable-hdfs-debug.sh --undo # Reset to INFO | ||
| # | ||
| # To target a non-default host/port: | ||
| # ./scripts/enable-hdfs-debug.sh --host localhost --port 8000 | ||
| # | ||
| # To set a specific logger manually: | ||
| # curl -X POST http://localhost:8000/actuator/loggers/org.apache.hadoop.hdfs.DFSClient \ | ||
| # -H 'Content-Type: application/json' \ | ||
| # -d '{"configuredLevel": "DEBUG"}' | ||
| # | ||
| # To check the current effective level of a logger: | ||
| # curl -s http://localhost:8000/actuator/loggers/org.apache.hadoop.hdfs.DFSClient \ | ||
| # | python3 -m json.tool | ||
| # | ||
| # To reset a logger to its inherited level: | ||
| # curl -X POST http://localhost:8000/actuator/loggers/org.apache.hadoop.hdfs.DFSClient \ | ||
| # -H 'Content-Type: application/json' \ | ||
| # -d '{"configuredLevel": null}' | ||
| # | ||
| set -euo pipefail | ||
|
|
||
| HOST="localhost" | ||
| PORT="8000" | ||
| UNDO=false | ||
|
|
||
| LOGGERS=( | ||
| # Filesystem layer — logs on FileSystem init and mount table refresh | ||
| "org.apache.hadoop.fs" | ||
| # NameNode HA proxy provider — covers all variants (IPFailover, ObserverRead, RequestHedging) | ||
| "org.apache.hadoop.hdfs.server.namenode.ha" | ||
| # IPC/RPC layer — connection establishment and retry events | ||
| "org.apache.hadoop.ipc.Client" | ||
| "org.apache.hadoop.io.retry.RetryInvocationHandler" | ||
| # HDFS client data path — silent on healthy ops; verbose on block errors/retries | ||
| "org.apache.hadoop.hdfs.DFSClient" | ||
| "org.apache.hadoop.hdfs.DFSInputStream" | ||
| "org.apache.hadoop.hdfs.DFSOutputStream" | ||
| "org.apache.hadoop.hdfs.DataStreamer" | ||
| # Iceberg metadata operations — table refresh, commit, CAS | ||
| "org.apache.iceberg" | ||
| ) | ||
|
|
||
| usage() { | ||
| cat <<'EOF' | ||
| Usage: enable-hdfs-debug.sh [OPTIONS] | ||
|
|
||
| Enable or disable HDFS/Iceberg debug logging on a local OpenHouse cluster. | ||
|
|
||
| Options: | ||
| --host HOST tables-service host (default: localhost) | ||
| --port PORT tables-service port (default: 8000) | ||
| --undo Reset loggers to inherited level | ||
| -h, --help Show this help | ||
| EOF | ||
| exit 0 | ||
| } | ||
|
|
||
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| --host) HOST="$2"; shift 2 ;; | ||
| --port) PORT="$2"; shift 2 ;; | ||
| --undo) UNDO=true; shift ;; | ||
| -h|--help) usage ;; | ||
| *) echo "Unknown option: $1"; usage ;; | ||
| esac | ||
| done | ||
|
|
||
| BASE_URL="http://${HOST}:${PORT}" | ||
|
|
||
| if ! curl -sf "${BASE_URL}/actuator/health" &>/dev/null; then | ||
| echo "ERROR: tables-service not responding at ${BASE_URL}." | ||
| echo " Start the cluster: ./gradlew dockerUp -Precipe=oh-hadoop" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if $UNDO; then | ||
| echo "Resetting HDFS debug loggers at ${BASE_URL} ..." | ||
| for logger in "${LOGGERS[@]}"; do | ||
| rc=$(curl -s -o /dev/null -w '%{http_code}' \ | ||
| -X POST "${BASE_URL}/actuator/loggers/${logger}" \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{"configuredLevel": null}') | ||
| [[ "$rc" == "204" || "$rc" == "200" ]] && echo " RESET $logger" || echo " FAILED $logger (HTTP $rc)" | ||
| done | ||
| echo "" | ||
| echo "Done. Logging restored to defaults." | ||
| else | ||
| echo "Enabling HDFS debug logging at ${BASE_URL} ..." | ||
| echo "" | ||
| FAILED=0 | ||
| for logger in "${LOGGERS[@]}"; do | ||
| rc=$(curl -s -o /dev/null -w '%{http_code}' \ | ||
| -X POST "${BASE_URL}/actuator/loggers/${logger}" \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{"configuredLevel": "DEBUG"}') | ||
| if [[ "$rc" == "204" || "$rc" == "200" ]]; then | ||
| echo " DEBUG $logger" | ||
| else | ||
| echo " FAILED $logger (HTTP $rc)" | ||
| FAILED=$((FAILED + 1)) | ||
| fi | ||
| done | ||
| echo "" | ||
| [[ $FAILED -gt 0 ]] && echo "WARNING: $FAILED logger(s) failed to set." | ||
| echo "HDFS debug logging active. Run table operations to generate log output." | ||
| echo "" | ||
| echo "When done: $0 --undo" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be arbiltrarilly big, no? What is the max size / is this bounded?